summaryrefslogtreecommitdiffstats
path: root/Include/pythonrun.h
Commit message (Collapse)AuthorAgeFilesLines
* ignore the coding cookie in compile(), exec(), and eval() if the source is a ↵Benjamin Peterson2009-03-021-0/+1
| | | | string #4626
* Merged revisions 64214 via svnmerge fromAmaury Forgeot d'Arc2008-06-131-1/+1
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r64214 | amaury.forgeotdarc | 2008-06-13 02:42:22 +0200 (ven., 13 juin 2008) | 6 lines Restore support for Microsoft VC6 compiler. Some functions in the msvcrt module are skipped, and socket.ioctl is enabled only when using a more recent Platform SDK. (and yes, there are still companies that use a 10-years old compiler) ........
* Renamed PyString to PyBytesChristian Heimes2008-05-261-1/+1
|
* Renamed PyBytes to PyByteArrayChristian Heimes2008-05-261-2/+2
|
* Change command line processing API to use wchar_t.Martin v. Löwis2008-04-051-9/+9
| | | | Fixes #2128.
* Merged revisions ↵Christian Heimes2008-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617-60678 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r60618 | walter.doerwald | 2008-02-06 15:31:55 +0100 (Wed, 06 Feb 2008) | 6 lines Remove month parameter from Calendar.yeardatescalendar(), Calendar.yeardays2calendar() and Calendar.yeardayscalendar() as the methods don't have such a parameter. Fixes issue #2017. Rewrap content to 80 chars. ........ r60622 | facundo.batista | 2008-02-06 20:28:49 +0100 (Wed, 06 Feb 2008) | 4 lines Fixes issue 1959. Converted tests to unittest. Thanks Giampaolo Rodola. ........ r60626 | thomas.heller | 2008-02-06 21:29:17 +0100 (Wed, 06 Feb 2008) | 3 lines Fixed refcounts and error handling. Should not be merged to py3k branch. ........ r60630 | mark.dickinson | 2008-02-06 23:10:50 +0100 (Wed, 06 Feb 2008) | 4 lines Issue 1979: Make Decimal comparisons (other than !=, ==) involving NaN raise InvalidOperation (and return False if InvalidOperation is trapped). ........ r60632 | mark.dickinson | 2008-02-06 23:25:16 +0100 (Wed, 06 Feb 2008) | 2 lines Remove incorrect usage of :const: in documentation. ........ r60634 | georg.brandl | 2008-02-07 00:45:51 +0100 (Thu, 07 Feb 2008) | 2 lines Revert accidental changes to test_queue in r60605. ........ r60636 | raymond.hettinger | 2008-02-07 01:54:20 +0100 (Thu, 07 Feb 2008) | 1 line Issue 2025: Add tuple.count() and tuple.index() to follow the ABC in collections.Sequence. ........ r60637 | mark.dickinson | 2008-02-07 02:14:23 +0100 (Thu, 07 Feb 2008) | 2 lines Fix broken link in decimal documentation. ........ r60638 | mark.dickinson | 2008-02-07 02:42:06 +0100 (Thu, 07 Feb 2008) | 3 lines IEEE 754 should be IEEE 854; give precise reference for comparisons involving NaNs. ........ r60639 | raymond.hettinger | 2008-02-07 03:12:52 +0100 (Thu, 07 Feb 2008) | 1 line Return ints instead of longs for tuple.count() and tuple.index(). ........ r60640 | raymond.hettinger | 2008-02-07 04:10:33 +0100 (Thu, 07 Feb 2008) | 1 line Merge 60627. ........ r60641 | raymond.hettinger | 2008-02-07 04:25:46 +0100 (Thu, 07 Feb 2008) | 1 line Merge r60628, r60631, and r60633. Register UserList and UserString will the appropriate ABCs. ........ r60642 | brett.cannon | 2008-02-07 08:47:31 +0100 (Thu, 07 Feb 2008) | 3 lines Cast a struct to a void pointer so as to do a type-safe pointer comparison (mistmatch found by clang). ........ r60643 | brett.cannon | 2008-02-07 09:04:07 +0100 (Thu, 07 Feb 2008) | 2 lines Remove unnecessary curly braces around an int literal. ........ r60644 | andrew.kuchling | 2008-02-07 12:43:47 +0100 (Thu, 07 Feb 2008) | 1 line Update URL ........ r60645 | facundo.batista | 2008-02-07 17:16:29 +0100 (Thu, 07 Feb 2008) | 4 lines Fixes issue 2026. Tests converted to unittest. Thanks Giampaolo Rodola. ........ r60646 | christian.heimes | 2008-02-07 18:15:30 +0100 (Thu, 07 Feb 2008) | 1 line Added some statistics code to dict and list object code. I wanted to test how a larger freelist affects the reusage of freed objects. Contrary to my gut feelings 80 objects is more than fine for small apps. I haven't profiled a large app yet. ........ r60648 | facundo.batista | 2008-02-07 20:06:52 +0100 (Thu, 07 Feb 2008) | 6 lines Fixes Issue 1401. When redirected, a possible POST get converted to GET, so it loses its payload. So, it also must lose the headers related to the payload (if it has no content any more, it shouldn't indicate content length and type). ........ r60649 | walter.doerwald | 2008-02-07 20:30:22 +0100 (Thu, 07 Feb 2008) | 3 lines Clarify that the output of TextCalendar.formatmonth() and TextCalendar.formatyear() for custom instances won't be influenced by calls to the module global setfirstweekday() function. Fixes #2018. ........ r60651 | walter.doerwald | 2008-02-07 20:48:34 +0100 (Thu, 07 Feb 2008) | 3 lines Fix documentation for Calendar.iterweekdays(): firstweekday is a property. Fixes second part of #2018. ........ r60653 | walter.doerwald | 2008-02-07 20:57:32 +0100 (Thu, 07 Feb 2008) | 2 lines Fix typo in docstring for Calendar.itermonthdays(). ........ r60655 | raymond.hettinger | 2008-02-07 21:04:37 +0100 (Thu, 07 Feb 2008) | 1 line The float conversion recipe is simpler in Py2.6 ........ r60657 | raymond.hettinger | 2008-02-07 21:10:49 +0100 (Thu, 07 Feb 2008) | 1 line Fix typo ........ r60660 | brett.cannon | 2008-02-07 23:27:10 +0100 (Thu, 07 Feb 2008) | 3 lines Make sure a switch statement does not have repetitive case statements. Error found through LLVM post-2.1 svn. ........ r60661 | christian.heimes | 2008-02-08 01:11:31 +0100 (Fri, 08 Feb 2008) | 1 line Deallocate content of the dict free list on interpreter shutdown ........ r60662 | christian.heimes | 2008-02-08 01:14:34 +0100 (Fri, 08 Feb 2008) | 1 line Use prefix decrement ........ r60663 | amaury.forgeotdarc | 2008-02-08 01:56:02 +0100 (Fri, 08 Feb 2008) | 5 lines issue 2045: Infinite recursion when printing a subclass of defaultdict, if default_factory is set to a bound method. Will backport. ........ r60667 | jeffrey.yasskin | 2008-02-08 07:45:40 +0100 (Fri, 08 Feb 2008) | 2 lines Oops! 2.6's Rational.__ne__ didn't work. ........ r60671 | hyeshik.chang | 2008-02-08 18:10:20 +0100 (Fri, 08 Feb 2008) | 2 lines Update big5hkscs codec to conform to the HKSCS:2004 revision. ........ r60673 | raymond.hettinger | 2008-02-08 23:30:04 +0100 (Fri, 08 Feb 2008) | 4 lines Remove unnecessary modulo division. The preceding test guarantees that 0 <= i < len. ........ r60674 | raymond.hettinger | 2008-02-09 00:02:27 +0100 (Sat, 09 Feb 2008) | 1 line Speed-up __iter__() mixin method. ........ r60675 | raymond.hettinger | 2008-02-09 00:34:21 +0100 (Sat, 09 Feb 2008) | 1 line Fill-in missing Set comparisons ........ r60677 | raymond.hettinger | 2008-02-09 00:57:06 +0100 (Sat, 09 Feb 2008) | 1 line Add advice on choosing between DictMixin and MutableMapping ........
* Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases ↵Christian Heimes2007-12-021-2/+0
| | | | in intobject.h
* Convert code from sys.stdin.encoding to UTF-8 inMartin v. Löwis2007-09-041-1/+2
| | | | interactive mode. Fixes #1100.
* Patch #1680961: remove sys.exitfunc and replace it with a private C API. ↵Collin Winter2007-03-211-0/+4
| | | | Also, reimplement atexit in C so it can take advantage of this private API.
* SF patch #1669633, add methods for bytes from Pete Shinners.Neal Norwitz2007-02-271-0/+2
|
* Checkpoint. 218 tests are okay; 53 are failing. Done so far:Guido van Rossum2006-03-151-3/+2
| | | | | | | | - all classes are new-style (but ripping out classobject.[ch] isn't done) - int/int -> float - all exceptions must derive from BaseException - absolute import - 'as' and 'with' are keywords
* Reconst parameters that lost their const in the AST merge.Martin v. Löwis2006-03-011-2/+2
|
* from __future__ import with_statement addon for 'with', mostly written byThomas Wouters2006-02-281-1/+2
| | | | Neal.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
* Generate code to recursively copy an AST intoMartin v. Löwis2006-02-261-0/+1
| | | | a tree of Python objects. Expose this through compile().
* Per discussion on python-dev, remove CO_GENERATOR_ALLOWED. Leave comment ↵Neal Norwitz2006-02-251-1/+1
| | | | about not removing yet.
* Drop sys.build_number. Add sys.subversion.Martin v. Löwis2006-01-051-1/+3
|
* Expose Subversion revision number (calculated via "svnversion .") to Python.Barry Warsaw2005-12-181-0/+1
| | | | | | | Add C API function Py_GetBuildNumber(), add it to the interactive prompt banner (i.e. Py_GetBuildInfo()), and add it as the sys.build_number attribute. The build number is a string instead of an int because it may contain a trailing 'M' if there are local modifications.
* Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,Neal Norwitz2005-12-171-2/+4
| | | | simplifies a lot of error handling code, and fixes many memory leaks.
* Correct error to PyRun_SimpleString macro introduced in AST merge.Mark Hammond2005-10-231-1/+1
|
* Merge ast-branch to headJeremy Hylton2005-10-201-31/+41
| | | | | | | | | | This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
* * Improve code for the empty frozenset singleton:Raymond Hettinger2005-08-011-0/+1
| | | | | | | | | | | - Handle both frozenset() and frozenset([]). - Do not use singleton for frozenset subclasses. - Finalize the singleton. - Add test cases. * Factor-out set_update_internal() from set_update(). Simplifies the code for several internal callers. * Factor constant expressions out of loop in set_merge_internal(). * Minor comment touch-ups.
* This is my patch:Michael W. Hudson2005-05-271-0/+1
| | | | | | | | | | | | | | [ 1181301 ] make float packing copy bytes when they can which hasn't been reviewed, despite numerous threats to check it in anyway if noone reviews it. Please read the diff on the checkin list, at least! The basic idea is to examine the bytes of some 'probe values' to see if the current platform is a IEEE 754-ish platform, and if so _PyFloat_{Pack,Unpack}{4,8} just copy bytes around. The rest is hair for testing, and tests.
* Finalize the freelist of list objects.Raymond Hettinger2004-10-071-0/+1
|
* Patch #900727: Add Py_InitializeEx to allow embedding without signals.Martin v. Löwis2004-08-191-0/+1
|
* Patch #1006003: Cygwin standard module build problemsJason Tishler2004-08-091-0/+1
| | | | Add missing PyAPI_FUNC/PyAPI_DATA macros.
* - Finally fixed the bug in compile() and exec where a string endingGuido van Rossum2003-02-131-0/+1
| | | | | | | | | with an indented code block but no newline would raise SyntaxError. This would have been a four-line change in parsetok.c... Except codeop.py depends on this behavior, so a compilation flag had to be invented that causes the tokenizer to revert to the old behavior; this required extra changes to 2 .h files, 2 .c files, and 2 .py files. (Fixes SF bug #501622.)
* patch #683515: "Add unicode support to compile(), eval() and exec"Just van Rossum2003-02-101-0/+1
| | | | Incorporated nnorwitz's comment re. Py__USING_UNICODE.
* Move _PyInt_Init() into pythonrun.h, since all the other _Init()Neal Norwitz2003-01-011-0/+1
| | | | functions are here. Suggested by Skip.
* Since the *_Init() are private, prefix with _, suggested by SkipNeal Norwitz2002-12-311-1/+1
|
* SF #561244, Micro optimizationsNeal Norwitz2002-12-301-0/+1
| | | | | | Initialize the small integers and __builtins__ in startup. This removes some if conditions. Change XDECREF to DECREF for values which shouldn't be NULL.
* PEP 302 + zipimport:Just van Rossum2002-12-301-0/+1
| | | | | | | | | | | | | - new import hooks in import.c, exposed in the sys module - new module called 'zipimport' - various changes to allow bootstrapping from zip files I hope I didn't break the Windows build (or anything else for that matter), but then again, it's been sitting on sf long enough... Regarding the latest discussions on python-dev: zipimport sets pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as /path/to/Archive.zip/subdir/ are supported again.
* Constify filenames and scripts. Fixes #651362.Martin v. Löwis2002-12-111-32/+32
|
* Patch #512981: Update readline input stream on sys.stdin/out change.Martin v. Löwis2002-10-261-2/+2
|
* Correct PyAPI_FUNC to PyAPI_DATA - sorry Jack.Mark Hammond2002-08-121-2/+2
|
* Excise DL_EXPORT from Include.Mark Hammond2002-08-121-57/+57
| | | | Thanks to Skip Montanaro and Kalle Svensson for the patches.
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-0/+3
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* Excise DL_IMPORT/EXPORT from object.h, and related files. This patchMark Hammond2002-07-291-20/+20
| | | | | also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido.
* Fix SF Bug 564931: compile() traceback must include filename.Thomas Heller2002-07-091-0/+4
|
* Removed more hair in support of future-generator stmts.Tim Peters2002-04-121-2/+2
|
* Add warning mode for classic division, almost exactly as specified inGuido van Rossum2001-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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).
* Refactor future feature handlingJeremy Hylton2001-08-101-7/+2
| | | | | | | | | | | | | | | | | | | 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.
* Implement PEP 238 in its (almost) full glory.Guido van Rossum2001-08-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge of descr-branch back into trunk.Tim Peters2001-08-021-2/+2
|
* Ugly. A pile of new xxxFlags() functions, to communicate to the parserTim Peters2001-07-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | 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-161-1/+6
| | | | | | | | | | 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.
* Add sys.excepthook.Ka-Ping Yee2001-03-231-0/+1
| | | | | | | | Update docstring and library reference section on 'sys' module. New API PyErr_Display, just for displaying errors, called by excepthook. Uncaught exceptions now call sys.excepthook; if that fails, we fall back to calling PyErr_Display directly. Also comes with sys.__excepthook__ and sys.__displayhook__.
* Extend support for from __future__ import nested_scopesJeremy Hylton2001-03-221-0/+13
| | | | | | | | | | | | | | | | | | | If a module has a future statement enabling nested scopes, they are also enable for the exec statement and the functions compile() and execfile() if they occur in the module. If Python is run with the -i option, which enters interactive mode after executing a script, and the script it runs enables nested scopes, they are also enabled in interactive mode. XXX The use of -i with -c "from __future__ import nested_scopes" is not supported. What's the point? To support these changes, many function variants have been added to pythonrun.c. All the variants names end with Flags and they take an extra PyCompilerFlags * argument. It is possible that this complexity will be eliminated in a future version of the interpreter in which nested scopes are not optional.
* Useful future statement support for the interactive interpreterJeremy Hylton2001-03-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | (Also remove warning about module-level global decl, because we can't distinguish from code passed to exec.) Define PyCompilerFlags type contains a single element, cf_nested_scopes, that is true if a nested scopes future statement has been entered at the interactive prompt. New API functions: PyNode_CompileFlags() PyRun_InteractiveOneFlags() -- same as their non Flags counterparts except that the take an optional PyCompilerFlags pointer compile.c: In jcompile() use PyCompilerFlags argument. If cf_nested_scopes is true, compile code with nested scopes. If it is false, but the code has a valid future nested scopes statement, set it to true. pythonrun.c: Create a new PyCompilerFlags object in PyRun_InteractiveLoop() and thread it through to PyRun_InteractiveOneFlags().