summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Implement PEP 238 in its (almost) full glory.Guido van Rossum2001-08-086-4/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | This introduces: - A new operator // that means floor division (the kind of division where 1/2 is 0). - The "future division" statement ("from __future__ import division) which changes the meaning of the / operator to implement "true division" (where 1/2 is 0.5). - New overloadable operators __truediv__ and __floordiv__. - New slots in the PyNumberMethods struct for true and floor division, new abstract APIs for them, new opcodes, and so on. I emphasize that without the future division statement, the semantics of / will remain unchanged until Python 3.0. Not yet implemented are warnings (default off) when / is used with int or long arguments. This has been on display since 7/31 as SF patch #443474. Flames to /dev/null.
* - Rename PyType_InitDict() to PyType_Ready().Guido van Rossum2001-08-071-1/+1
| | | | | | - Add an explicit call to PyType_Ready(&PyList_Type) to pythonrun.c (just for the heck of it, really -- we should either explicitly ready all types, or none).
* Got rid of (hopefully) the last 68k-mac related ifdefs.Jack Jansen2001-08-071-62/+0
|
* Patch #448194: Debuging negative reference counts.Martin v. Löwis2001-08-051-5/+6
|
* Removed duplicate definnitions of PyObject_AS_GC and PyObject_FROM_GC ↵Jack Jansen2001-08-031-2/+0
| | | | (occurred only if GC was off).
* Merge of descr-branch back into trunk.Tim Peters2001-08-0214-20/+220
|
* Enable PyOS_snprintf() et al. during alpha phase of 2.2.0 andMarc-André Lemburg2001-07-311-0/+7
| | | | add another use case to the socketmodule.
* As discussed on python-dev: this patch adds name mangling toMarc-André Lemburg2001-07-311-0/+150
| | | | | assure that extensions and interpreters using the Unicode APIs were compiled using the same Unicode width.
* va_list is defined in stdarg.h.Marc-André Lemburg2001-07-311-0/+1
|
* This patch turns the Python API mismatch notice into a standardMarc-André Lemburg2001-07-311-0/+16
| | | | | | | | | | | | Python warning which can be catched by means of the Python warning framework. It also adds two new APIs which hopefully make it easier for Python to switch to buffer overflow safe [v]snprintf() APIs for error reporting et al. The two new APIs are PyOS_snprintf() and PyOS_vsnprintf() and work just like the standard ones in many C libs. On platforms which have snprintf(), the native APIs are used, on all other an emulation with snprintf() tries to do its best.
* Add _PyUnicode_AsDefaultEncodedString to unicodeobject.h.Jeremy Hylton2001-07-301-0/+17
| | | | | | | And remove all the extern decls in the middle of .c files. Apparently, it was excluded from the header file because it is intended for internal use by the interpreter. It's still intended for internal use and documented as such in the header file.
* Repair more now-obsolete references to config.h.Tim Peters2001-07-264-4/+4
|
* Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774.Martin v. Löwis2001-07-263-3/+3
|
* Fix typo in comment.Neil Schemenauer2001-07-231-1/+1
|
* Add -E command line switch (ignore environment variables like PYTHONHOMENeil Schemenauer2001-07-231-0/+6
| | | | and PYTHONPATH).
* Add a low-level API to access interpreters, for David Beazley.Guido van Rossum2001-07-191-0/+7
| | | | SF patch #436376.
* Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.Martin v. Löwis2001-07-181-0/+3
| | | | Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
* Ugly. A pile of new xxxFlags() functions, to communicate to the parserTim Peters2001-07-162-0/+11
| | | | | | | | | | | | | | | | | | | | | | | that 'yield' is a keyword. This doesn't help test_generators at all! I don't know why not. These things do work now (and didn't before this patch): 1. "from __future__ import generators" now works in a native shell. 2. Similarly "python -i xxx.py" now has generators enabled in the shell if xxx.py had them enabled. 3. This program (which was my doctest proxy) works fine: from __future__ import generators source = """\ def f(): yield 1 """ exec compile(source, "", "single") in globals() print type(f())
* Part way to allowing "from __future__ import generators" to communicateTim Peters2001-07-164-3/+20
| | | | | | | | | | that info to code dynamically compiled *by* code compiled with generators enabled. Doesn't yet work because there's still no way to tell the parser that "yield" is OK (unlike nested_scopes, the parser has its fingers in this too). Replaced PyEval_GetNestedScopes by a more-general PyEval_MergeCompilerFlags. Perhaps I should not have? I doubted it was *intended* to be part of the public API, so just did.
* Preliminary support for "from __future__ import generators" to enableGuido van Rossum2001-07-151-0/+3
| | | | | | | | the yield statement. I figure we have to have this in before I can release 2.2a1 on Wednesday. Note: test_generators is currently broken, I'm counting on Tim to fix this.
* Python.h: Don't attempt to redefine NDEBUG if it's already defined.Tim Peters2001-07-151-0/+2
| | | | Others: Remove redundant includes of assert.h.
* Define NDEBUG when Py_DEBUG undefined, to disable the assert macro.Guido van Rossum2001-07-151-0/+4
|