Commit Graph

21987 Commits

Author SHA1 Message Date
Tim Peters b1da050131 Fixed a typo in a new comment. 2002-03-31 02:51:40 +00:00
Tim Peters 2c95c99a64 _PyMalloc_Free(): As was already done for _PyMalloc_Malloc, rearranged
the code so that the most frequent cases come first.  Added comments.
Found a hidden assumption that a pool contains room for at least two
blocks, and added an assert to catch a violation if it ever happens in
a place where that matters.  Gave the normal "I allocated this block"
case a longer basic block to work with before it has to do its first
branch (via breaking apart an embedded assignment in an "if", and
hoisting common code out of both branches).
2002-03-31 02:18:01 +00:00
Tim Peters 1e16db6d3b Added a long-overdue comment block giving an overview of pool operations
and terminology, plus explanation of some extreme obscurities.
2002-03-31 01:05:22 +00:00
Jack Jansen e7f776af3d Suite to talk to the OSX Terminal application. 2002-03-30 23:46:16 +00:00
Jack Jansen ad5dcafac4 Got rid of obsolete way to get at various toolbox types. 2002-03-30 23:44:58 +00:00
Jack Jansen 77afbc0b3b Add Mac/Lib/lib-scriptpackages to sys.path too. 2002-03-30 23:43:36 +00:00
Jack Jansen 4092606d6b Modified to allow it to run in MachoPython in a reasonable way. It still
needs a decent commandline interface, though.
2002-03-30 23:43:04 +00:00
Tim Peters c2ce91af5f It's once again thought safe to call the pymalloc free/realloc with an
address obtained from system malloc/realloc without holding the GIL.

When the vector of arena base addresses has to grow, the old vector is
deliberately leaked.  This makes "stale" x-thread references safe.
arenas and narenas are also declared volatile, and changed in an order
that prevents a thread from picking up a value of narenas too large
for the value of arenas it sees.

Added more asserts.

Fixed an old inaccurate comment.

Added a comment explaining why it's safe to call pymalloc free/realloc
with an address obtained from system malloc/realloc even when arenas is
still NULL (this is obscure, since the ADDRESS_IN_RANGE macro
appears <wink> to index into arenas).
2002-03-30 21:36:04 +00:00
Tim Peters 7b85b4aa7f new_arena(): In error cases, reset the number of available pools to 0.
Else the pymalloc malloc will go insane the next time it's called.
2002-03-30 10:42:09 +00:00
Tim Peters 1d99af8d69 Changed the #-of-arenas counters to uints -- no need to be insane about
this.  But added an overflow check just in case there is.

Got rid of the ushort macro.  It wasn't used anymore (it was only used
in the no-longer-exists off_t macro), and there's no plausible use for it.
2002-03-30 10:35:09 +00:00
Tim Peters 8deda70b16 Eliminate DONT_SHARE_SHORT_STRINGS. 2002-03-30 10:06:07 +00:00
Martin v. Löwis 522cf1f6fb Patch #536908: Add missing #include guards/extern "C". 2002-03-30 08:57:12 +00:00
Tim Peters df4d1377ed Turns out the off_t macro isn't used anymore, so got rid of it. 2002-03-30 07:07:24 +00:00
Tim Peters 3c83df2047 Now that we're no longer linking arenas together, there's no need to
waste the first pool if malloc happens to return a pool-aligned address.

This means the number of pools per arena can now vary by 1.  Unfortunately,
the code counted up from 0 to a presumed constant number of pools.  So
changed the increasing "watermark" counter to a decreasing "nfreepools"
counter instead, and fiddled various stuff accordingly.  This also allowed
getting rid of two more macros.

Also changed the code to align the first address to a pool boundary
instead of a page boundary.  These are two parallel sets of macro #defines
that happen to be identical now, but the page macros are in theory more
restrictive (bigger), and there's simply no reason I can see that it
wasn't aligning to the less restrictive pool size all along (the code
only relies on pool alignment).

Hmm.  The "page size" macros aren't used for anything *except* defining
the pool size macros, and the comments claim the latter isn't necessary.
So this has the feel of a layer of indirection that doesn't serve a
purpose; should probably get rid of the page macros now.
2002-03-30 07:04:41 +00:00
Tim Peters 12300686ca Retract the claim that this is always safe if PyMem_{Del, DEL, Free, FREE}
are called without the GIL.  It's incredibly unlikely to fail, but I can't
make this bulletproof without either adding a lock for exclusion, or
giving up on growing the arena base-address vector (it would be safe if
this were a static array).
2002-03-30 06:20:23 +00:00
Tim Peters d97a1c008c Lots of changes:
+ A new scheme for determining whether an address belongs to a pymalloc
  arena.  This should be 100% reliable.  The poolp->pooladdr and
  poolp->magic members are gone.  A new poolp->arenaindex member takes
  their place.  Note that the pool header overhead doesn't actually
  shrink, though, since the header is padded to a multiple of 8 bytes.

+ _PyMalloc_Free and _PyMalloc_Realloc should now be safe to call for
  any legit address, whether obtained from a _PyMalloc function or from
  the system malloc/realloc.  It should even be safe to call
   _PyMalloc_Free when *not* holding the GIL, provided that the passed-in
  address was obtained from system malloc/realloc.  Since this is
  accomplished without any locks, you better believe the code is subtle.
  I hope it's sufficiently commented.

+ The above implies we don't need the new PyMalloc_{New, NewVar, Del}
  API anymore, and could switch back to PyObject_XXX without breaking
  existing code mixing PyObject_XXX with PyMem_{Del, DEL, Free, FREE}.
  Nothing is done here about that yet, and I'd like to see this new
  code exercised more first.

+ The small object threshhold is boosted to 256 (the max).  We should
  play with that some more, but the old 64 was way too small for 2.3.

+ Getting a new arena is now done via new function new_arena().

+ Removed some unused macros, and squashed out some macros that were
  used only once to define other macros.

+ Arenas are no longer linked together.  A new vector of arena base
  addresses had to be created anyway to make address classification
  bulletproof.

+ A lot of the patch size is an illusion:  given the way address
  classification works now, it was more convenient to switch the
  sense of the prime "if" tests in the realloc and free functions,
  so the "if" and "else" blocks got swapped.

+ Assorted minor code, comment and whitespace cleanup.

Back to the Windows installer <wink>.
2002-03-30 06:09:22 +00:00
Jack Jansen 61ef790907 Auxiliary files used by BuildApplet for MachoPython. 2002-03-29 23:48:55 +00:00
Jack Jansen 8134976fee Auxiliary files for building the IDE applet. Running the IDE through
BuildApplet for MachoPython now seems to do the right thing, yeah!
2002-03-29 23:46:34 +00:00
Jack Jansen 9aa8fd0b7d Handle .icns and .plist files for applets.
Also, for now (until we learn to parse .plist files) we make a special case
for the IDE, setting the creator to "Pide".
2002-03-29 23:44:37 +00:00
Jack Jansen 96f9e0864a Missed one version number. 2002-03-29 23:43:21 +00:00
Fred Drake fe5a5388c3 Use the right types for a couple of fields of the type structure. 2002-03-29 22:46:04 +00:00
Fred Drake 0ffd14c9ea Started updating information about defining attributes on types.
There's still a long way to go, but we're starting to see some real
content in the docs.
2002-03-29 22:45:28 +00:00
Jack Jansen bdcb1c4597 First stab at an icon for the IDE. 2002-03-29 22:28:32 +00:00
Just van Rossum ca3d307271 repair damage: canceling the "save options" dialog now works again. 2002-03-29 21:48:42 +00:00
Just van Rossum 8bb61c8d4c repair damage: now works again as a CFM app. 2002-03-29 21:47:56 +00:00
Jack Jansen 9a38947fba Completely revamped newline handling. PyEdit is now newline-preserving
(if a single newline convention is used in the sourcefile), and the
"save options" has a newline style radio button.

The creator radio button also has the new choices PythonW and None.

Just: just shout (and revert) if you don't agree.
2002-03-29 21:26:04 +00:00
Jack Jansen e0ba087d44 Allow file without filetype as long as they end in ".py".
Added a -D flag (can really only be specified on OSX commandline) to not
revector sys.stderr, for debugging the IDE itself. Not sure whether
this should stay.
2002-03-29 21:23:47 +00:00
Jack Jansen b2e33fe285 Implemented buildtools for MachoPython .app bundles. The API is compatible
enough that IDE and BuildApplet can create applets, yeah!
2002-03-29 21:21:28 +00:00
Jack Jansen 32f782c03c Don't attempt to create a dummy fsspec if the user cancelled out, just
return None.

For now, if the user asks for TEXT files files without type are also
accepted. But it is time to phase out StandardGetFile and friends, really.
2002-03-29 21:19:37 +00:00
Jack Jansen d21c9f48fa Re-raise the Res.Error if the file doesn't exist. 2002-03-29 21:17:57 +00:00
Jack Jansen 2cce33f3bd Added -Wno-long-double 2002-03-29 21:17:14 +00:00
Jack Jansen c5fa303e78 Changed visible name (in dock, menubar) of the interpreter to PythonW.
Changed version numbers and copyright.
2002-03-29 21:16:41 +00:00
Neil Schemenauer cc07ec17a3 Add missing typecast. 2002-03-29 19:58:25 +00:00
Andrew M. Kuchling f4a4fb9a11 [Patch #536769] Add -Xcompiler flag for adding arguments and switches for
the compiler
2002-03-29 18:00:19 +00:00
Martin v. Löwis 1142de3f5b Patch #527027: Allow building python as shared library. 2002-03-29 16:28:31 +00:00
Andrew M. Kuchling eddd68d56c As part of fixing bug #536241, add a test case for string.zfill() with Unicode 2002-03-29 16:21:44 +00:00
Andrew M. Kuchling 102d1208a8 [Bug #536241] string.zfill() produces mangled output for a Unicode string.
Walter Doerwald provided a patch, which I've modified in two ways:

1) (Uncontroversial) Removed code to make module work in earlier versions of
   Python without the unicode() built-in

2) (Poss. controversial) Instead of making string.zfill take the repr()
   of non-string objects, take the str().

Should a warning be added to this branch of the code so that the automatic
str() can be deprecated?

2.2.2 bugfix candidate, assuming the repr()->str() change is deemed OK.
2002-03-29 16:20:33 +00:00
Andrew M. Kuchling c6c9c4a10f Add two tests for string.zfill 2002-03-29 16:00:13 +00:00
Jack Jansen 3cef721b61 Allow .pyc files as applets as well as .py files. .py files have
priority, for safety reasons.
2002-03-29 14:43:50 +00:00
Jack Jansen 5053b70da0 If the file has no resource fork first check to see whether it's a
datafork-based resource file before trying to decode it as AppleSingle.
2002-03-29 14:29:35 +00:00
Jack Jansen 695b33b02a Removed debug. 2002-03-29 14:28:09 +00:00
Jack Jansen 0035fb27f4 In MachoPython print "Pythonw" in banner to distinguish from command-line
python.
Removed debug output.
2002-03-29 14:27:06 +00:00
Jack Jansen 0cd0e656ef Added target "installunixprograms" which installs python and pythonw in
/usr/local/bin (referring to the framework-based interpreter and Python.app).

Added target symlinkmacsubtree to aid in debugging.
2002-03-29 14:18:18 +00:00
Jack Jansen ab10ce6c6b Shell script that invokes Python.app from the command line. Called pythonw
because of similarity to the same program on Windows.
2002-03-29 14:15:22 +00:00
Tim Peters 1f7df3595a Remove the CACHE_HASH and INTERN_STRINGS preprocessor symbols. 2002-03-29 03:29:08 +00:00
Neil Schemenauer 835840560b Call PyObject_GC_UnTrack before putting an object on the list of trash. 2002-03-29 03:07:29 +00:00
Neil Schemenauer f589c059f4 If the GC is enabled then don't use the ob_type pointer to create a list
of trash objects.  Use the gc_prev pointer instead.
2002-03-29 03:05:54 +00:00
Neil Schemenauer b883310d59 Make _PyObject_GC_UnTrack do nothing if WITH_CYCLE_GC is not defined. 2002-03-29 03:04:25 +00:00
Guido van Rossum 95b62a6dd4 News for SF #535905. 2002-03-29 01:07:24 +00:00
Fred Drake b1af6376e9 Mark a couple of types that had not been marked. 2002-03-28 23:46:41 +00:00