summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Fix more ssize_t issues.Martin v. Löwis2006-04-221-5/+5
|
* Py_ssize_t issue; repr()'ing a very large string would result in a teensyThomas Wouters2006-04-211-1/+1
| | | | string, because of a cast to int.
* Fix variable/format-char discrepancy in new-style class __getitem__,Thomas Wouters2006-04-211-4/+4
| | | | | | | __delitem__, __setslice__ and __delslice__ hooks. This caused test_weakref and test_userlist to fail in the p3yk branch (where UserList, like all classes, is new-style) on amd64 systems, with open-ended slices: the sys.maxint value for empty-endpoint was transformed into -1.
* Make s.replace() work with explicit counts exceeding 2Gb.Thomas Wouters2006-04-191-2/+2
|
* Use Py_ssize_t to hold the 'width' argument to the ljust, rjust, center andThomas Wouters2006-04-191-8/+8
| | | | | | zfill stringmethods, so they can create strings larger than 2Gb on 64bit systems (even win64.) The unicode versions of these methods already did this right.
* Refactor: Move code that uses co_lnotab from ceval to codeobjectJeremy Hylton2006-04-181-0/+133
|
* Comment typo fixAndrew M. Kuchling2006-04-181-1/+1
|
* Remove types from type_list if they have no objectsMartin v. Löwis2006-04-181-6/+33
| | | | | and unlist_types_without_objects is set. Give dump_counts a FILE* argument.
* C++ compiler cleanup: bunch-o-casts, plus use of unsigned loop index var in ↵Skip Montanaro2006-04-186-28/+29
| | | | a couple places
* C++ compilation cleanup: Migrate declaration ofSkip Montanaro2006-04-181-7/+0
| | | | | _PyObject_Call(Function|Method)_SizeT into Include/abstract.h. This gets them under the umbrella of the extern "C" { ... } block in that file.
* No need to cast a Py_ssize_t, use %z in PyErr_FormatNeal Norwitz2006-04-171-2/+2
|
* Use %zd instead of %i as format character (in call to PyErr_Format) forThomas Wouters2006-04-161-1/+1
| | | | Py_ssize_t argument.
* gen_del(): Looks like much this was copy/pasted fromTim Peters2006-04-151-1/+1
| | | | | | slot_tp_del(), but while the latter had to cater to types that don't participate in GC, we know that generators do. That allows strengthing an assert().
* Remove now-unused variables from tp_traverse and tp_clear methods.Tim Peters2006-04-152-3/+0
|
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-1513-257/+68
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* - Whitespace normalizationThomas Wouters2006-04-151-12/+14
| | | | | | - In functions where we already hold the same object in differently typed pointers, use the correctly typed pointer instead of casting the other pointer a second time.
* Use Py_CLEAR instead of in-place DECREF/XDECREF or custom macros, forThomas Wouters2006-04-153-16/+4
| | | | tp_clear methods.
* Clear dummy and emptyfrozenset, so that we don't haveMartin v. Löwis2006-04-151-2/+2
| | | | | dangling references in case of a Py_Initialize/Py_Finalize cycle.
* Unlink the structseq type from the global list ofMartin v. Löwis2006-04-151-0/+8
| | | | | | | objects before initializing it. It might be linked already if there was a Py_Initialize/Py_Finalize cycle earlier; not unlinking it would break the global list.
* frame_clear(): Explain why it's important to make the frameTim Peters2006-04-151-18/+11
| | | | | look dead right at the start. Use Py_CLEAR for four more frame members.
* frame_traverse(): Use the standard Py_VISIT macro.Tim Peters2006-04-151-16/+14
| | | | | | | Py_VISIT: cast the `op` argument to PyObject* when calling `visit()`. Else the caller has to pay too much attention to this silly detail (e.g., frame_traverse needs to traverse `struct _frame *` and `PyCodeObject *` pointers too).
* Trimmed trailing whitespace.Tim Peters2006-04-151-13/+12
|
* Fix SF#1470508: crash in generator cycle finalization. There were twoPhillip J. Eby2006-04-152-19/+22
| | | | | | | | | | | problems: first, PyGen_NeedsFinalizing() had an off-by-one bug that prevented it from ever saying a generator didn't need finalizing, and second, frame objects cleared themselves in a way that caused their owning generator to think they were still executable, causing a double deallocation of objects on the value stack if there was still a loop on the block stack. This revision also removes some unnecessary close() operations from test_generators that are now appropriately handled by the cycle collector.
* Make Py_BuildValue, PyObject_CallFunction andMartin v. Löwis2006-04-143-28/+92
| | | | PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
* Change more occurrences of maxsplit to Py_ssize_t.Martin v. Löwis2006-04-131-4/+4
|
* Change maxsplit types to Py_ssize_t.Martin v. Löwis2006-04-131-4/+4
|
* Replace INT_MAX with PY_SSIZE_T_MAX.Martin v. Löwis2006-04-131-2/+2
|
* Replace INT_MAX with PY_SSIZE_T_MAX where string lengthMartin v. Löwis2006-04-131-4/+4
| | | | are concerned.
* Remove another INT_MAX limitationMartin v. Löwis2006-04-131-2/+1
|
* Replace most INT_MAX with PY_SSIZE_T_MAX.Martin v. Löwis2006-04-131-11/+11
|
* Change more ints to Py_ssize_t.Martin v. Löwis2006-04-131-40/+39
|
* Revert 34153: Py_UNICODE should not be signed.Martin v. Löwis2006-04-131-8/+3
|
* spread the extern "C" { } magic pixie dust around. Python itself builds nowAnthony Baxter2006-04-133-0/+28
| | | | | using a C++ compiler. Still lots and lots of errors in the modules built by setup.py, and a bunch of warnings from g++ in the core.
* Add a cast to make code compile with a C++ compiler.Anthony Baxter2006-04-131-1/+1
|
* Don't set gi_frame to Py_None, use NULL instead, eliminating some insanePhillip J. Eby2006-04-121-7/+7
| | | | pointer dereferences.
* Ignore the references to the dummy objects used as deleted keysArmin Rigo2006-04-123-1/+34
| | | | in dicts and sets when computing the total number of references.
* wrap docstrings so they are less than 80 columns. add spaces after commas.Neal Norwitz2006-04-121-3/+5
|
* gen_throw(): The caller doesn't own PyArg_ParseTuple()Tim Peters2006-04-121-3/+1
| | | | | | "O" arguments, so must not decref them. This accounts for why running test_contextlib.test_main() in a loop eventually tried to deallocate Py_None.
* Fix int() and long() to repr() their argument when formatting the exception,Thomas Wouters2006-04-112-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to avoid confusing situations like: >>> int("") ValueError: invalid literal for int(): >>> int("2\n\n2") ValueError: invalid literal for int(): 2 2 Also report the base used, to avoid: ValueError: invalid literal for int(): 2 They now report: >>> int("") ValueError: invalid literal for int() with base 10: '' >>> int("2\n\n2") ValueError: invalid literal for int() with base 10: '2\n\n2' >>> int("2", 2) ValueError: invalid literal for int() with base 2: '2' (Reporting the base could be avoided when base is 10, which is the default, but hrm.) Another effect of these changes is that the errormessage can be longer; before, it was cut off at about 250 characters. Now, it can be up to four times as long, as the unrepr'ed string is cut off at 200 characters, instead. No tests were added or changed, since testing for exact errormsgs is (pardon the pun) somewhat errorprone, and I consider not testing the exact text preferable. The actually changed code is tested frequent enough in the test_builtin test as it is (120 runs for each of ints and longs.)
* _Py_PrintReferenceAddresses,_Py_PrintReferences:Tim Peters2006-04-111-7/+3
| | | | | | | | | | interpolate PY_FORMAT_SIZE_T for refcount display instead of casting refcounts to long. I understand that gcc on some boxes delivers nuisance warnings about this, but if any new ones appear because of this they'll get fixed by magic when the others get fixed.
* Correct casts to char*.Martin v. Löwis2006-04-111-4/+4
|
* Remove "static forward" declaration. Move constructorsMartin v. Löwis2006-04-113-85/+79
| | | | after the type objects.
* Get compiling againNeal Norwitz2006-04-111-1/+1
|
* More low-hanging fruit. Still need to re-arrange some code (or find a betterAnthony Baxter2006-04-115-79/+80
| | | | | solution) in the same way as listobject.c got changed. Hoping for a better solution.
* More C++-compliance. Note especially listobject.c - to get C++ to accept theAnthony Baxter2006-04-118-136/+147
| | | | | | | | | PyTypeObject structures, I had to make prototypes for the functions, and move the structure definition ahead of the functions. I'd dearly like a better way to do this - to change this would make for a massive set of changes to the codebase. There's still some warnings - this is purely to get rid of errors first.
* Patch #837242: id() for large ptr should return a long.Martin v. Löwis2006-04-101-3/+9
|
* SF Patch #1463867: Improved generator finalization to allow generatorsPhillip J. Eby2006-04-101-0/+20
| | | | | | | | that are suspended outside of any try/except/finally blocks to be garbage collected even if they are part of a cycle. Generators that suspend inside of an active try/except or try/finally block (including those created by a ``with`` statement) are still not GC-able if they are part of a cycle, however.
* Remove dead code (reported by HP compiler).Neal Norwitz2006-04-061-8/+5
| | | | Can probably be backported if anyone cares.
* Add PY_SSIZE_T_MIN, as suggested by Ralf W. Grosse-Kunstleve.Martin v. Löwis2006-04-051-1/+1
|
* Make xrange more Py_ssize_t aware, by assuming a Py_ssize_t is always atThomas Wouters2006-04-041-7/+0
| | | | | | | | | | | least as big as a long. I believe this to be a safe assumption that is being made in many parts of CPython, but a check could be added. len(xrange(sys.maxint)) works now, so fix the testsuite's odd exception for 64-bit platforms too. It also fixes 'zip(xrange(sys.maxint), it)' as a portable-ish (if expensive) alternative to enumerate(it); since zip() now calls len(), this was breaking on (real) 64-bit platforms. No additional test was added for that behaviour.