Commit Graph

2377 Commits

Author SHA1 Message Date
Neal Norwitz abab1d44bb Fix a warning on ppc (debian) 2006-04-28 05:28:54 +00:00
Neal Norwitz 237bf40746 Fix a warning on alpha 2006-04-28 05:28:30 +00:00
Thomas Wouters 9df4e6f673 - Add new Warning class, ImportWarning
- Warn-raise ImportWarning when importing would have picked up a directory
   as package, if only it'd had an __init__.py. This swaps two tests (for
   case-ness and __init__-ness), but case-test is not really more expensive,
   and it's not in a speed-critical section.

 - Test for the new warning by importing a common non-package directory on
   sys.path: site-packages

 - In regrtest.py, silence warnings generated by the build-environment
   because Modules/ (which is added to sys.path for Setup-created modules)
   has 'zlib' and '_ctypes' directories without __init__.py's.
2006-04-27 23:13:20 +00:00
Thomas Wouters 1ddba60e3d Define MAXPATHLEN to be at least PATH_MAX, if that's defined. Python uses
MAXPATHLEN-sized buffers for various output-buffers (like to realpath()),
and that's correct on BSD platforms, but not Linux (which uses PATH_MAX, and
does not define MAXPATHLEN.) Cursory googling suggests Linux is following a
newer standard than BSD, but in cases like this, who knows. Using the
greater of PATH_MAX and 1024 as a fallback for MAXPATHLEN seems to be the
most portable solution.
2006-04-25 15:29:46 +00:00
Martin v. Löwis 6685128b97 Fix more ssize_t issues. 2006-04-22 11:40:03 +00:00
Thomas Wouters 79cdce35de Teach Python/ceval.c's inlining of 'str += str' about Py_ssize_t sizes; this
was having funny effects when called on >2Gb strings ;P
2006-04-19 15:09:44 +00:00
Thomas Heller 1b04664eab Change those parts of the Python-api that were functions in 2.4, and
are now macros to exported functions again.

Fixes [ 1465834 ] bdist_wininst preinstall script support is broken in 2.5a1.
2006-04-18 18:51:06 +00:00
Jeremy Hylton a4ebc135ac Refactor: Move code that uses co_lnotab from ceval to codeobject 2006-04-18 14:47:00 +00:00
Martin v. Löwis 45294a9562 Remove types from type_list if they have no objects
and unlist_types_without_objects is set.
Give dump_counts a FILE* argument.
2006-04-18 06:24:08 +00:00
Skip Montanaro b507972cdd C++ compiler cleanup: cast... 2006-04-18 00:57:15 +00:00
Skip Montanaro 53a6d1de83 C++ compiler cleanup: extern "C" a couple declarations, cast int to size_t 2006-04-18 00:55:46 +00:00
Skip Montanaro 7ff54e7706 C++ compiler cleanup: migrate to modsupport.h 2006-04-18 00:53:48 +00:00
Ronald Oussoren 6c1074888e This patches fixes a number of byteorder problems in MacOSX specific code. 2006-04-17 13:40:08 +00:00
Neal Norwitz 1a26920506 moduleName can be NULL 2006-04-17 00:33:23 +00:00
Thomas Wouters b8f81d4863 Add missing DECREF to PyErr_WriteUnraisable(). That function reports
exceptions that can't be raised any further, because (for instance) they
occur in __del__ methods. The coroutine tests in test_generators was
triggering this leak. Remove the leakers' testcase, and add a simpler
testcase that explicitly tests this leak to test_generators.

test_generators now no longer leaks at all, on my machine. This fix may also
solve other leaks, but my full refleakhunting run is still busy, so who
knows?
2006-04-15 23:27:28 +00:00
Thomas Wouters c6e55068ca Use Py_VISIT in all tp_traverse methods, instead of traversing manually or
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
2006-04-15 21:47:09 +00:00
Martin v. Löwis ab0e284a24 Zap ZAP. 2006-04-15 18:14:21 +00:00
Thomas Wouters edf17d8798 Use Py_CLEAR instead of in-place DECREF/XDECREF or custom macros, for
tp_clear methods.
2006-04-15 17:28:34 +00:00
Martin v. Löwis 841747cb56 Fix sys.getobjects(0): we get a reference to the
arena's "private" list of objects, so there might
be two references to that list.
2006-04-15 12:46:09 +00:00
Martin v. Löwis 5cb6936672 Make Py_BuildValue, PyObject_CallFunction and
PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
2006-04-14 09:08:42 +00:00
Neal Norwitz 615461603c SF Bug #1454485, array.array('u') could crash the interpreter when
passing a string.  Martin already fixed the actual crash by ensuring
Py_UNICODE is unsigned.  As discussed on python-dev, this fix
removes the possibility of creating a unicode string from a raw buffer.

There is an outstanding question of how to fix the crash in 2.4.
2006-04-14 05:20:28 +00:00
Neal Norwitz 8c0dc84398 ALIGNMENT_SHIFT is not used 2006-04-14 03:53:34 +00:00
Martin v. Löwis da69041123 Force 8-alignment of memory blocks, as needed on
64-bit machines that require pointers to be aligned (e.g. IA64)
2006-04-13 19:16:13 +00:00
Martin v. Löwis f33dea2961 Fix type errors. 2006-04-13 13:08:58 +00:00
Martin v. Löwis 0cc56e5c59 Introduce asdl_int_seq, to hold cmpop_ty. 2006-04-13 12:29:43 +00:00
Skip Montanaro 869bacd465 revert - breaks build of Python/ast.c w/ gcc 2006-04-13 09:48:28 +00:00
Skip Montanaro b940671186 Use union to discriminate pointer types from enum/int types. 2006-04-13 09:37:01 +00:00
Georg Brandl 7f573f7319 Add a test for Py_ssize_t. Correct typo in getargs.c. 2006-04-13 07:59:30 +00:00
Martin v. Löwis b1ed7fac12 Replace INT_MAX with PY_SSIZE_T_MAX. 2006-04-13 07:52:27 +00:00
Anthony Baxter ac6bd46d5c spread the extern "C" { } magic pixie dust around. Python itself builds now
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.
2006-04-13 02:06:09 +00:00
Anthony Baxter d691f1a35f casting nastiness to make C++ compiler happy 2006-04-13 01:23:28 +00:00
Armin Rigo e170937af6 Ignore the references to the dummy objects used as deleted keys
in dicts and sets when computing the total number of references.
2006-04-12 17:06:05 +00:00
Anthony Baxter 97300387ec avoid C++ name mangling for the _Py.*SizeT functions 2006-04-12 04:38:54 +00:00
Anthony Baxter 019aec618a Make symtable.c safe for C++ compilers. Changed macros in the same way as
compile.c to add a cast.
2006-04-12 04:00:50 +00:00
Anthony Baxter 2c33fc77fe per Jeremy's email, remove the _WITH_CAST versions of macros. g++
still has errors from the casts of asdl_seq_GET to cmpop_ty, but
otherwise it's C++ clean.
2006-04-12 00:43:09 +00:00
Thomas Wouters ced6cddc03 Part two of the fix for SF bug #1466641: Regenerate graminit.c and add test
for the bogus failure.
2006-04-12 00:07:59 +00:00
Anthony Baxter 64182fe0b3 Some more changes to make code compile under a C++ compiler. 2006-04-11 12:14:09 +00:00
Anthony Baxter 7b782b61c5 more low-hanging fruit to make code compile under a C++ compiler. Not
entirely happy with the two new VISIT macros in compile.c, but I
couldn't see a better approach.
2006-04-11 12:01:56 +00:00
Martin v. Löwis 2845750c5b Convert 0 to their respective enum types. Convert
void* to their respective _ty types. Fix signature of
ast_for_exprlist.
2006-04-11 09:17:27 +00:00
Martin v. Löwis 9eec489c4a Regenerate. 2006-04-11 09:03:33 +00:00
Martin v. Löwis 01b810106c Make _kind types global for C++ compilation.
Explicitly cast void* to int to cmpop_ty.
2006-04-11 08:06:50 +00:00
Anthony Baxter a863d334aa low-hanging fruit in Python/ - g++ still hates all the enum_kind declarations
in Python/Python-ast.c. Not sure what to do about those.
2006-04-11 07:43:46 +00:00
Phillip J. Eby 2ba96610bf SF Patch #1463867: Improved generator finalization to allow generators
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.
2006-04-10 17:51:05 +00:00
Neal Norwitz 14bc4e4d89 Use PyObject_* allocator since FutureFeatures is small 2006-04-10 06:57:06 +00:00
Neal Norwitz b183a25c29 Fix some warnings on HP-UX when using cc/aCC 2006-04-10 01:03:32 +00:00
Martin v. Löwis ad7c44c047 Regenerate. 2006-04-07 06:26:31 +00:00
Thomas Wouters 4bdaa271d6 Fix refleak in __import__("") (probably the cause of the 2 refleaks in
test_builtin.)
2006-04-05 13:39:37 +00:00
Thomas Wouters 8ddab27182 Fix __import__("") to raise ValueError rather than return None. 2006-04-04 16:17:02 +00:00
Jeremy Hylton ed40ea1159 Generate line number table entries for except handlers.
Re-enable all the tests in test_trace.py except one.  Still not sure that these tests test what they used to test, but they pass.  One failing test seems to be caused by undocumented line number table behavior in Python 2.4.
2006-04-04 14:26:39 +00:00
Martin v. Löwis c95dd9488a Disable .DLL as an extension for extension modules. 2006-04-04 07:04:07 +00:00