summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* Add optional docstrings to member descriptors. For backwardsGuido van Rossum2001-09-203-2/+18
| | | | | | | | | | | | | | | compatibility, this required all places where an array of "struct memberlist" structures was declared that is referenced from a type's tp_members slot to change the type of the structure to PyMemberDef; "struct memberlist" is now only used by old code that still calls PyMember_Get/Set. The code in PyObject_GenericGetAttr/SetAttr now calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef argument. As examples, I added actual docstrings to the attributes of a few types: file, complex, instance method, super, and xxsubtype.spamlist. Also converted the symtable to new style getattr.
* Patch #435971: UTF-7 codec by Brian Quinlan.Marc-André Lemburg2001-09-201-0/+18
|
* Fix for bug #462737.Marc-André Lemburg2001-09-191-3/+3
|
* Hopefully fix 3-way comparisons. This unfortunately adds yet anotherGuido van Rossum2001-09-181-0/+4
| | | | | | | | hack, and it's even more disgusting than a PyInstance_Check() call. If the tp_compare slot is the slot used for overrides in Python, it's always called. Add some tests that show what should work too.
* Add support for restricting access based on restricted execution mode.Guido van Rossum2001-09-171-2/+6
| | | | | | Renamed the 'readonly' field to 'flags' and defined some new flag bits: READ_RESTRICTED and WRITE_RESTRICTED, as well as a shortcut RESTRICTED that means both.
* SF bug [#460467] file objects should be subclassable.Tim Peters2001-09-132-1/+3
| | | | Preliminary support. What's here works, but needs fine-tuning.
* Again perhaps the end of [#460020] bug or feature: unicode() and subclasses.Tim Peters2001-09-121-0/+1
| | | | | Inhibited complex unary plus optimization when applied to a complex subtype. Added PyComplex_CheckExact macro. Some comments and minor code fiddling.
* Possibly the end of SF [#460020] bug or feature: unicode() and subclasses.Tim Peters2001-09-111-0/+2
| | | | | Changed unicode(i) to return a true Unicode object when i is an instance of a unicode subclass. Added PyUnicode_CheckExact macro.
* More on SF bug [#460020] bug or feature: unicode() and subclasses.Tim Peters2001-09-111-0/+1
| | | | | Repaired str(i) to return a genuine string when i is an instance of a str subclass. New PyString_CheckExact() macro.
* More on SF bug [#460020] bug or feature: unicode() and subclasses.Tim Peters2001-09-101-0/+1
| | | | | | | | tuple(i) repaired to return a true tuple when i is an instance of a tuple subclass. Added PyTuple_CheckExact macro. PySequence_Tuple(): if a tuple-like object isn't exactly a tuple, it's not safe to return the object as-is -- make a new tuple of it instead.
* Prototype for PyMac_GetFullPathname().Jack Jansen2001-09-101-0/+1
|
* More for SF bug [#460020] bug or feature: unicode() and subclassesTim Peters2001-09-101-0/+1
| | | | | Repair float constructor to return a true float when passed a subclass instance. New PyFloat_CheckExact macro.
* SF bug #460020: bug or feature: unicode() and subclasses.Tim Peters2001-09-103-0/+5
| | | | | | | | | | | Given an immutable type M, and an instance I of a subclass of M, the constructor call M(I) was just returning I as-is; but it should return a new instance of M. This fixes it for M in {int, long}. Strings, floats and tuples remain to be done. Added new macros PyInt_CheckExact and PyLong_CheckExact, to more easily distinguish between "is" and "is a" (i.e., only an int passes PyInt_CheckExact, while any sublass of int passes PyInt_Check). Added private API function _PyLong_Copy.
* PyModule_Check() now checks for subtype of module, as it should.Guido van Rossum2001-09-101-1/+1
|
* Generalize operator.indexOf (PySequence_Index) to work with anyTim Peters2001-09-081-8/+18
| | | | | | | | | | iterable object. I'm not sure how that got overlooked before! Got rid of the internal _PySequence_IterContains, introduced a new internal _PySequence_IterSearch, and rewrote all the iteration-based "count of", "index of", and "is the object in it or not?" routines to just call the new function. I suppose it's slower this way, but the code duplication was getting depressing.
* Bumping version numbers.Barry Warsaw2001-09-071-2/+2
|
* Rename 'getset' to 'property'.Guido van Rossum2001-09-061-1/+1
|
* Add PyMethod_Function(), PyMethod_Self(), PyMethod_Class() back.Guido van Rossum2001-09-051-0/+4
| | | | | | While not even documented, they were clearly part of the C API, there's no great difficulty to support them, and it has the cool effect of not requiring any changes to ExtensionClass.c.
* Rework the way we try to check for libm overflow, given that C99 no longerTim Peters2001-09-051-3/+30
| | | | | | | | | | | | | | | requires that errno ever get set, and it looks like glibc is already playing that game. New rules: + Never use HUGE_VAL. Use the new Py_HUGE_VAL instead. + Never believe errno. If overflow is the only thing you're interested in, use the new Py_OVERFLOWED(x) macro. If you're interested in any libm errors, use the new Py_SET_ERANGE_IF_OVERFLOW(x) macro, which attempts to set errno the way C89 said it worked. Unfortunately, none of these are reliable, but they work on Windows and I *expect* under glibc too.
* Repair indentation.Tim Peters2001-09-051-5/+5
|
* Try to recover from that glibc's ldexp apparently doesn't set errno onTim Peters2001-09-051-0/+20
| | | | | overflow. Needs testing on Linux (test_long.py and test_long_future.py especially).
* At Guido's suggestion, here's a new C API function, PyObject_Dir(), likeTim Peters2001-09-041-0/+8
| | | | __builtin__.dir(). Moved the guts from bltinmodule.c to object.c.
* Introduce new private API function _PyLong_AsScaledDouble. Not used yet,Tim Peters2001-09-041-0/+9
| | | | | | | | | | but will be the foundation for Good Things: + Speed PyLong_AsDouble. + Give PyLong_AsDouble the ability to detect overflow. + Make true division of long/long nearly as accurate as possible (no spurious infinities or NaNs). + Return non-insane results from math.log and math.log10 when passing a long that can't be approximated by a double better than HUGE_VAL.
* Fix the names of _PyObject_GC_TRACK and _PyObject_GC_UNTRACK when the GC isNeil Schemenauer2001-09-031-2/+2
| | | | disabled. Obviously everyone enables the GC. :-)
* Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef.Jack Jansen2001-09-011-1/+5
| | | | Moved the declarations to pymactoolbox.h.
* Add warning mode for classic division, almost exactly as specified inGuido van Rossum2001-08-312-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PEP 238. Changes: - add a new flag variable Py_DivisionWarningFlag, declared in pydebug.h, defined in object.c, set in main.c, and used in {int,long,float,complex}object.c. When this flag is set, the classic division operator issues a DeprecationWarning message. - add a new API PyRun_SimpleStringFlags() to match PyRun_SimpleString(). The main() function calls this so that commands run with -c can also benefit from -Dnew. - While I was at it, I changed the usage message in main() somewhat: alphabetized the options, split it in *four* parts to fit in under 512 bytes (not that I still believe this is necessary -- doc strings elsewhere are much longer), and perhaps most visibly, don't display the full list of options on each command line error. Instead, the full list is only displayed when -h is used, and otherwise a brief reminder of -h is displayed. When -h is used, write to stdout so that you can do `python -h | more'. Notes: - I don't want to use the -W option to control whether the classic division warning is issued or not, because the machinery to decide whether to display the warning or not is very expensive (it involves calling into the warnings.py module). You can use -Werror to turn the warnings into exceptions though. - The -Dnew option doesn't select future division for all of the program -- only for the __main__ module. I don't know if I'll ever change this -- it would require changes to the .pyc file magic number to do it right, and a more global notion of compiler flags. - You can usefully combine -Dwarn and -Dnew: this gives the __main__ module new division, and warns about classic division everywhere else.
* Make the Py<type>_Check() macro use PyObject_TypeCheck().Guido van Rossum2001-08-303-3/+3
|
* Change the GC type flag since the API has changed. Allow types usingNeil Schemenauer2001-08-291-50/+66
| | | | | | | the old flag to still compile. Remove the PyType_BASICSIZE and PyType_SET_BASICSIZE macros. Add PyObject_GC_New, PyObject_GC_NewVar, PyObject_GC_Resize, PyObject_GC_Del, PyObject_GC_Track, PyObject_GC_UnTrack. Part of SF patch #421893.
* Change the GC type flag since the API has changed. Allow types usingNeil Schemenauer2001-08-291-6/+10
| | | | the old flag to still compile.
* Make frames a PyVarObject instead of a PyObject.Neil Schemenauer2001-08-291-2/+1
|
* SF bug [#456252] Python should never stomp on [u]intptr_t.Tim Peters2001-08-291-5/+14
| | | | | | | | | | | pyport.h: typedef a new Py_intptr_t type. DELICATE ASSUMPTION: That HAVE_UINTPTR_T implies intptr_t is available as well as uintptr_t. If that turns out not to be true, things must get uglier (C99 wants both, so I think it's an assumption we're *likely* to get away with). thread_nt.h, PyThread_start_new_thread: MS _beginthread is documented as returning unsigned long; no idea why uintptr_t was being used. Others: Always use Py_[u]intptr_t, never [u]intptr_t directly.
* Make the PyXXX_Check() macros for the numeric types inheritance-aware.Guido van Rossum2001-08-294-4/+4
|
* PyString_FromFormat() and PyString_FromFormatV(): Largely ripped fromBarry Warsaw2001-08-241-0/+4
| | | | | | | | | | | | | | | | | | | PyErr_Format() these new C API methods can be used instead of sprintf()'s into hardcoded char* buffers. This allows us to fix many situation where long package, module, or class names get truncated in reprs. PyString_FromFormat() is the varargs variety. PyString_FromFormatV() is the va_list variety Original PyErr_Format() code was modified to allow %p and %ld expansions. Many reprs were converted to this, checkins coming soo. Not changed: complex_repr(), float_repr(), float_print(), float_str(), int_repr(). There may be other candidates not yet converted. Closes patch #454743.
* Add decl of PySuper_Type; fixup comments for the two other types.Guido van Rossum2001-08-241-2/+3
|
* Add new built-in type 'getset' (PyGetSet_Type).Guido van Rossum2001-08-231-0/+3
| | | | This implements the 'getset' class from test_binop.py.
* Introduce OverflowWarning -- to be issued when short int operationsGuido van Rossum2001-08-231-0/+1
| | | | are overflowing and a long int operation is substituted.
* Merge changes from r22a2-branch back into trunk. Also, change patchBarry Warsaw2001-08-221-2/+2
| | | | level to 2.2a2+
* ceval, PyEval_MergeCompilerFlags: wasn't merging in theTim Peters2001-08-171-0/+2
| | | | | | | | | | | | | | CO_FUTURE_DIVISION flag. Redid this to use Jeremy's PyCF_MASK #define instead, so we dont have to remember to fiddle individual feature names here again. pythonrun.h: Also #define a PyCF_MASK_OBSOLETE mask. This isn't used yet, but will be as part of the PEP 264 implementation (compile() mustn't raise an error just because old code uses a flag name that's become obsolete; a warning may be appropriate, but not an error; so compile() has to know about obsolete flags too, but nobody is going to remember to update compile() with individual obsolete flag names across releases either -- i.e., this is the flip side of PyEval_MergeCompilerFlags's oversight).
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-174-0/+13
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* - Get rid of obsolete #define PATCHLEVEL.Guido van Rossum2001-08-171-4/+1
| | | | - Change PY_VERSION (but not the numeric versions) to "2.2a1+".
* Added comments before recently added/assigned slots in the type object,Fred Drake2001-08-151-0/+6
| | | | | so the backward compatibility issues will be easier to understand. I only added comments indicating additions and assignments back to Python 2.0.
* Remove much dead code from ceval.cJeremy Hylton2001-08-121-0/+5
| | | | | | | | | | | | | | The descr changes moved the dispatch for calling objects from call_object() in ceval.c to PyObject_Call() in abstract.c. call_object() and the many functions it used in ceval.c were no longer used, but were not removed. Rename meth_call() as PyCFunction_Call() so that it can be called by the CALL_FUNCTION opcode in ceval.c. Also, fix error message that referred to PyEval_EvalCodeEx() by its old name eval_code2(). (I'll probably refer to it by its old name, too.)
* Remove st_nested_scopes from struct symtable,Jeremy Hylton2001-08-111-1/+0
| | | | | | | because nested scopes are always enabled. (Accidentally checked in one small change along this path yesterday, wreaking havoc in the Windows build.)
* Refactor future feature handlingJeremy Hylton2001-08-102-16/+3
| | | | | | | | | | | | | | | | | | | Replace individual slots in PyFutureFeatures with a single bitmask with one field per feature. The flags for this bitmask are the same as the flags used in the co_flags slot of a code object. XXX This means we waste several bits, because they are used for co_flags but have no meaning for future statements. Don't think this is an issue. Remove the NESTED_SCOPES_DEFAULT define and others. Not sure what they were for anyway. Remove all the PyCF_xxx flags, but define PyCF_MASK in terms of the CO_xxx flags that are relevant for this release. Change definition of PyCompilerFlags so that cf_flags matches co_flags.
* Add PyDict_Merge(a, b, override):Guido van Rossum2001-08-101-0/+1
| | | | | | PyDict_Merge(a, b, 1) is the same as PyDict_Update(a, b). PyDict_Merge(a, b, 0) does something similar but leaves existing items unchanged.
* Add new flags for PyType_Ready(): READY to explicitly indicate theGuido van Rossum2001-08-101-0/+6
| | | | | | type is ready, and READYING to indicate that it is busy with the type. A recursive call is a fatal error.
* SF patch #438013 Remove 2-byte Py_UCS2 assumptionsTim Peters2001-08-091-6/+0
| | | | | | | | Removed all instances of Py_UCS2 from the codebase, and so also (I hope) the last remaining reliance on the platform having an integral type with exactly 16 bits. PyUnicode_DecodeUTF16() and PyUnicode_EncodeUTF16() now read and write one byte at a time.
* Remove 6-year old hack to worm around a bug in "NextSpec/Sparc 3.3Tim Peters2001-08-081-12/+0
| | | | pre-release limits.h".
* Split macglue.c into two: a new mactoolboxglue.c (in ./Python)Jack Jansen2001-08-081-0/+168
| | | | | | | | | | | | with functionality needed for both unix-Python and MacPython and a new smaller ./Mac/Python/macglue.c which contains MacPython stuff only. pymactoolbox.h has moved to ./Include from ./Mac/Include and now also contains the relevant stuff from macglue.h. The net effect of this is that the ./Mac subdirectory is not needed anymore for building the unix-Python core on MacOSX (it is needed for building the extension modules).
* Put conditional S_ISDIR definition(s) into pyport.h.Martin v. Löwis2001-08-081-0/+13
|