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
Jeremy Hylton
2f327c14eb
Add lineno, col_offset to excephandler to enable future fix for
...
tracing/line number table in except blocks.
Reflow long lines introduced by col_offset changes. Update test_ast
to handle new fields in excepthandler.
As note in Python.asdl says, we might want to rethink how attributes
are handled. Perhaps they should be the same as other fields, with
the primary difference being how they are defined for all types within
a sum.
Also fix asdl_c so that constructors with int fields don't fail when
passed a zero value.
2006-04-04 04:00:23 +00:00
Martin v. Löwis
ea62d2535f
Bug #1421664 : Set sys.stderr.encoding
2006-04-03 10:56:49 +00:00
Neal Norwitz
cbce280d4f
Don't abbreviate ABS, use long name ABSOLUTE.
2006-04-03 06:26:32 +00:00
Neal Norwitz
19379f18a6
* Fix a refleak of *_attributes.
...
* Cleanup formatting a bit (add spaces).
* Move static var initialized inside init_types() since that's the only place
it's used.
2006-04-03 04:50:58 +00:00
Neal Norwitz
92e212f7d9
Accept keyword arguments for __import__ and doc the addition of the level param from PEP 328.
2006-04-03 04:48:37 +00:00
Jeremy Hylton
12603c41da
Expand comments on line numbers and blocks.
...
Reorder compiler_set_lineno() call for consistency.
2006-04-01 16:18:02 +00:00
Georg Brandl
ccadf84a1b
Patch #1460496 : round() now accepts keyword arguments.
2006-03-31 18:54:53 +00:00
Jeremy Hylton
296aef8ebb
Expand comments.
...
Explicitly clear all elements from arena->a_objects and remove
assert() that refcount is 1. It's possible for a program to get a
reference to the list via sys.getobjects() or via gc functions.
2006-03-31 16:41:22 +00:00
Tim Peters
62e97f023b
In format strings slinging Py_ssize_t, unconditionally
...
interpolate PY_FORMAT_SIZE_T instead of #if'ing on
MS_WIN64.
2006-03-28 21:44:32 +00:00
Armin Rigo
d34fa52a06
answer a question from a comment
2006-03-28 19:10:40 +00:00
Neal Norwitz
33b730e33c
Fix SF bug #1458903 with AST compiler.
...
def foo((x)): was getting recognized as requiring tuple unpacking
which is not correct.
Add tests for this case and the proper way to unpack a tuple of one:
def foo((x,)):
test_inpsect was incorrect before. I'm not sure why it was passing,
but that has been corrected with a test for both functions above.
This means the test (and therefore inspect.getargspec()) are broken in 2.4.
2006-03-27 08:58:23 +00:00
Tim Peters
c9d78aa470
Years in the making.
...
objimpl.h, pymem.h: Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE}
to PyObject_{Free, FREE} in a release build. They're aliases for the
system free() now.
_subprocess.c/sp_handle_dealloc(): Since the memory was originally
obtained via PyObject_NEW, it must be released via PyObject_FREE (or
_DEL).
pythonrun.c, tokenizer.c, parsermodule.c: I lost count of the number of
PyObject vs PyMem mismatches in these -- it's like the specific
function called at each site was picked at random, sometimes even with
memory obtained via PyMem getting released via PyObject. Changed most
to use PyObject uniformly, since the blobs allocated are predictably
small in most cases, and obmalloc is generally faster than system
mallocs then.
If extension modules in real life prove as sloppy as Python's front
end, we'll have to revert the objimpl.h + pymem.h part of this patch.
Note that no problems will show up in a debug build (all calls still go
thru obmalloc then). Problems will show up only in a release build, most
likely segfaults.
2006-03-26 23:27:58 +00:00
Skip Montanaro
4ec3c26952
Found this in an old email message from Hartmut Goebel.
2006-03-25 14:12:03 +00:00
Hye-Shik Chang
d478f3453f
Patch #1396919 : Reenable the system scope threads on FreeBSD 5.4
...
and later versions because they bumped the default setting to
get our basic tests to run correctly..
2006-03-23 12:32:36 +00:00
Neal Norwitz
90768424f8
Fix a ssize_t issue
2006-03-23 05:48:09 +00:00
Neal Norwitz
e98ccf6690
Forward port MvL's fix in 43227:
...
Fix crash when a Unicode string containing an encoding declaration is
compile()d. Fixes #1115379 .
2006-03-23 05:39:47 +00:00
Neal Norwitz
2aa9a5dfdd
Use macro versions instead of function versions when we already know the type.
...
This will hopefully get rid of some Coverity warnings, be a hint to
developers, and be marginally faster.
Some asserts were added when the type is currently known, but depends
on values from another function.
2006-03-20 01:53:23 +00:00
Walter Dörwald
ba8e180f3b
Release codecs variable earlier.
2006-03-18 14:05:43 +00:00
Georg Brandl
5c170fd4a9
Fix some missing checks after PyTuple_New, PyList_New, PyDict_New
2006-03-17 19:03:25 +00:00
Nick Coghlan
77858684e4
Fix bug 1441408 where a double colon didn't trigger extended slice semantics (applies patch 1452332)
2006-03-17 17:59:10 +00:00
Walter Dörwald
d53850a2be
Fix wrong argument format in PyCodec_IncrementalEncoder() and
...
PyCodec_IncrementalDecoder().
Factor out common code from PyCodec_Encoder()/PyCodec_Decoder(),
PyCodec_IncrementalEncoder()/PyCodec_IncrementalDecoder() and
PyCodec_StreamReader()/PyCodec_StreamWriter().
2006-03-16 21:46:40 +00:00
Neal Norwitz
4fe4ed2525
Make mktuple consistent with mklist to get rid of Coverity warnings. Also use macro version of SetItem since we know everything is setup.
2006-03-16 08:20:19 +00:00
Walter Dörwald
abb02e5994
Patch #1436130 : codecs.lookup() now returns a CodecInfo object (a subclass
...
of tuple) that provides incremental decoders and encoders (a way to use
stateful codecs without the stream API). Functions
codecs.getincrementaldecoder() and codecs.getincrementalencoder() have
been added.
2006-03-15 11:35:15 +00:00
Nick Coghlan
eadee9a744
Fix SF bug #1448804 and ad a test to ensure that all subscript operations continue to be handled correctly
2006-03-13 12:31:58 +00:00
Guido van Rossum
f669436189
Um, I thought I'd already checked this in.
...
Anyway, this is the changes to the with-statement
so that __exit__ must return a true value in order
for a pending exception to be ignored.
The PEP (343) is already updated.
2006-03-10 02:28:35 +00:00
Neal Norwitz
72c2c062d7
Try to be a bit more consistent on all platforms:
...
python .
python < .
both print a message, return non-zero and do not core dump.
2006-03-09 05:58:11 +00:00
Guido van Rossum
38fff8c4e4
Checking in the code for PEP 357.
...
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
2006-03-07 18:50:55 +00:00
Guido van Rossum
9d7855076a
Address an coverity issue. Coverity was complaining about a line that's fine,
...
but an earlier line checked for v != NULL unnecessarily.
2006-03-07 18:31:44 +00:00
Hye-Shik Chang
4af5c8cee4
SF #1444030 : Fix several potential defects found by Coverity.
...
(reviewed by Neal Norwitz)
2006-03-07 15:39:21 +00:00
Martin v. Löwis
725507b52e
Change int to Py_ssize_t in several places.
...
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
2006-03-07 12:08:51 +00:00
Neal Norwitz
f2e0c45492
Fix warnings on x86 (32-bit).
2006-03-06 23:31:27 +00:00
Neal Norwitz
3e90fa5940
Try to cleanup the error handling a bit so there aren't false positives
...
from static analysis. v was already checked for NULL above, so we don't
need a second check.
2006-03-06 23:07:34 +00:00
Martin v. Löwis
99b93c2824
Use %Id for size_t-ish things on Win64.
2006-03-05 05:33:54 +00:00
Neal Norwitz
4281cef205
Use Py_ssize_t for _Py_RefTotal.
...
I tried to handle Win64 properly, but please review.
2006-03-04 19:58:13 +00:00
Neal Norwitz
9589ee276a
Tabify
2006-03-04 19:01:22 +00:00
Neal Norwitz
e92fba0a12
Get rid of run_err_mod(). It was only used in two places.
...
One place it wasn't necessary since mod was already checked.
Inline the check that mod != NULL for the other use.
2006-03-04 18:52:26 +00:00
Neal Norwitz
10be2ea85d
SF bug 1442442: LIST_APPEND optimization got lost in the AST merge.
...
Add it back.
2006-03-03 20:29:11 +00:00
Neal Norwitz
9742f27a9a
Remove commented code
2006-03-03 19:13:57 +00:00
Brett Cannon
3909ff69e2
Text moved to PEP 339.
2006-03-02 22:08:16 +00:00
Brett Cannon
5118517c16
Fix minor docstring typo.
2006-03-02 22:07:40 +00:00
Tim Peters
f6386306fb
Document the purpose of the struct _block members.
2006-03-02 21:41:18 +00:00
Tim Peters
6fd92dc44f
Added words about what PyArena_Malloc() does.
2006-03-02 21:14:45 +00:00
Tim Peters
8cfaa0e729
Trimmed trailing whitespace.
2006-03-02 20:37:32 +00:00
Brett Cannon
2e63b73a2c
Fix refleak in PyErr_Display().
2006-03-02 18:34:57 +00:00
Neal Norwitz
d9cf85f421
Fix refleak if from __future__ import was not first
2006-03-02 08:08:42 +00:00
Neal Norwitz
814e938d08
Use Py_ssize_t since we are working with list size below
2006-03-02 07:54:28 +00:00
Brett Cannon
46872b1613
Add a missing Py_DECREF to BaseException__unicode__ .
2006-03-02 04:31:55 +00:00
Neal Norwitz
3a5468efb0
Update known issues to reflect reality
2006-03-02 04:06:10 +00:00
Martin v. Löwis
03e5bc02c9
Fix memory leak on attributes.
2006-03-02 00:31:27 +00:00
Thomas Wouters
695934a0ef
Make Py_ssize_t clean.
2006-03-01 23:49:13 +00:00
Martin v. Löwis
49c5da1d88
Patch #1440601 : Add col_offset attribute to AST nodes.
2006-03-01 22:49:05 +00:00
Thomas Wouters
7464b43e41
Fix incompatible assignment warning from previous checkin.
2006-03-01 22:34:09 +00:00
Thomas Wouters
7f401ef73d
Fix gcc (4.0.x) warning about use of uninitialized variables.
...
(PyMarshal_ReadShortFromFile() is only used in zipimport.c, I don't believe
the extra initializations will matter one way or another.)
2006-03-01 22:30:47 +00:00
Brett Cannon
54ac29497e
Document PEP 352 changes. Also added GeneratorExit.
2006-03-01 22:10:49 +00:00
Thomas Wouters
65b3dab50e
Fix uninitialized value. (Why are we using bools instead of ints, like we do
...
everywhere else?)
2006-03-01 22:06:23 +00:00
Martin v. Löwis
0b300be895
Fix more memory leaks. Will backport to 2.4.
2006-03-01 21:33:54 +00:00
Thomas Wouters
c3547a311e
Fix C99-ism, and add XXX to comment
2006-03-01 21:31:21 +00:00
Martin v. Löwis
056a69cba6
Reconst parameters that lost their const in the AST merge.
2006-03-01 16:55:42 +00:00
Jeremy Hylton
e9357b21c0
Tabify and reflow some long lines.
...
Much of the peephole optimizer is now indented badly, but it's about
to be revised anyway.
2006-03-01 15:47:05 +00:00
Jeremy Hylton
224003baef
Add missing DECREF.
2006-03-01 15:02:24 +00:00
Thomas Wouters
572a9f32dc
Use %zd format characters for Py_ssize_t types.
2006-03-01 05:38:39 +00:00
Thomas Wouters
7f59732716
Put back the essence of Jeremy's original XXX comment.
2006-03-01 05:32:33 +00:00
Brett Cannon
bf36409e2a
PEP 352 implementation. Creates a new base class, BaseException, which has an
...
added message attribute compared to the previous version of Exception. It is
also a new-style class, making all exceptions now new-style. KeyboardInterrupt
and SystemExit inherit from BaseException directly. String exceptions now
raise DeprecationWarning.
Applies patch 1104669, and closes bugs 1012952 and 518846.
2006-03-01 04:25:17 +00:00
Martin v. Löwis
762467475d
Use Py_ssize_t for PyArg_UnpackTuple arguments.
2006-03-01 04:06:10 +00:00
Neal Norwitz
53d960c010
Don't pollute namespace as bad as before. All the types are static now.
2006-02-28 22:47:29 +00:00
Thomas Wouters
8ae1295c5b
Make 'as' an actual keyword when with's future statement is used. Not
...
actually necessary for functionality, but good for transition.
2006-02-28 22:42:15 +00:00
Neal Norwitz
090b3dde06
No need to export PySTEntry_New, it is only used in symtable.c
2006-02-28 22:36:46 +00:00
Guido van Rossum
1a5e21e033
Updates to the with-statement:
...
- New semantics for __exit__() -- it must re-raise the exception
if type is not None; the with-statement itself doesn't do this.
(See the updated PEP for motivation.)
- Added context managers to:
- file
- thread.LockType
- threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
- decimal.Context
- Added contextlib.py, which defines @contextmanager, nested(), closing().
- Unit tests all around; bot no docs yet.
2006-02-28 21:57:43 +00:00
Thomas Wouters
5e9f1fa706
Generally inehrit codeflags that are in PyCF_MASK, instead of writing it out
...
in multiple places. This makes compile()/eval()/etc also inherit the
absolute-import codeflag, like division and with-statement already were.
2006-02-28 20:02:27 +00:00
Jeremy Hylton
56820c2bab
Add some stats collection in debugging mode.
...
No good way to extract output yet.
2006-02-28 19:57:06 +00:00
Thomas Wouters
34aa7ba114
from __future__ import with_statement addon for 'with', mostly written by
...
Neal.
2006-02-28 19:02:24 +00:00
Jeremy Hylton
99b4ee6373
Use simple PyList to implement list of PyObject pointers
2006-02-28 18:52:28 +00:00
Jeremy Hylton
08533fdad6
Tabify
2006-02-28 18:29:00 +00:00