summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* require list comprehensions to start with a for clauseSkip Montanaro2000-08-222-9/+9
|
* com_print_stmt(): Guido rightly points out that the stream expressionBarry Warsaw2000-08-211-5/+22
| | | | | in extended prints should only be evaluated once. This patch plays stack games (documented!) to fix this.
* Thomas reminds me to bump the MAGIC number for the extended printBarry Warsaw2000-08-211-1/+1
| | | | opcode additions.
* PEP 214, Extended print Statement, has been accepted by the BDFL.Barry Warsaw2000-08-212-138/+184
| | | | | | | eval_code2(): Implement new bytecodes PRINT_ITEM_TO and PRINT_NEWLINE_TO, as per accepted SF patch #100970. Also update graminit.c based on related Grammar/Grammar changes.
* PEP 214, Extended print Statement, has been accepted by the BDFL.Barry Warsaw2000-08-211-8/+36
| | | | | | com_print_stmt(): Implement recognition of, and byte compilation for, extended print using new byte codes PRINT_ITEM_TO and PRINT_NEWLINE_TO.
* Fix the bug Sjoerd Mullender discovered, where find_from_args() wasn'tThomas Wouters2000-08-201-1/+3
| | | | | | | | | | trying hard enough to find out what the arguments to an import were. There is no test-case for this bug, yet, but this is what it looked like: from encodings import cp1006, cp1026 ImportError: cannot import name cp1026 '__import__' was called with only the first name in the 'arguments' list.
* Disallow "import mod.submod as m", because the result is ambiguous. Does itThomas Wouters2000-08-191-1/+2
| | | | | | | | | | load mod.submod as m, or mod as m ? Both can be achieved differently, and unambiguously. Also attempt to document this restriction (editor appreciated!) Note that this is an artificial check during compile, because incorporating this in the grammar is hard, and then adjusting the compiler to do the right thing with the right nodes is harder.
* com_error(): Quiet gcc -Wall warning.Barry Warsaw2000-08-181-1/+0
|
* Remove a couple of warnings turned up by "gcc -Wall".Fred Drake2000-08-182-3/+4
|
* Do not set a MemoryError exception over another MemoryError exception,Vladimir Marangozov2000-08-181-0/+4
| | | | thus preserving the first one that has been raised.
* SyntaxError__classinit__(): Slight reorg for simplicity.Barry Warsaw2000-08-181-4/+4
|
* comples_from_string(): Move s_buffer[] up to the top-level functionBarry Warsaw2000-08-181-2/+1
| | | | | | scope. Previously, s_buffer[] was defined inside the PyUnicode_Check() scope, but referred to in the outer scope via assignment to s. This quiets an Insure portability warning.
* Apply SF patch #101135, adding 'import module as m' and 'from module importThomas Wouters2000-08-174-690/+793
| | | | | | | | name as n'. By doing some twists and turns, "as" is not a reserved word. There is a slight change in semantics for 'from module import name' (it will now honour the 'global' keyword) but only in cases that are explicitly undocumented.
* _PySys_Init(): Fix another Insure discovered memory leak; the PyStringBarry Warsaw2000-08-161-1/+2
| | | | created from the "big"/"little" constant needs to be decref'd.
* SyntaxError__str__(): Fix two memory problems discovered by Insure.Barry Warsaw2000-08-161-4/+9
| | | | | | | First, the allocated buffer was never freed after using it to create the PyString object. Second, it was possible that have_filename would be false (meaning that filename was not a PyString object), but that the code would still try to PyString_GET_SIZE() it.
* Fix new compiler warnings. Unused var in compile.c. Argsize mismatchesTim Peters2000-08-151-1/+0
| | | | | | in binascii.c (only on platforms with signed chars -- although Py_CHARMASK is documented as returning an int, it only does so on platforms with signed chars).
* my_basename(): Removes the leading path components from a path name,Fred Drake2000-08-151-2/+23
| | | | | | | | returning a pointer to the start of the file's "base" name; similar to os.path.basename(). SyntaxError__str__(): Use my_basename() to keep the length of the file name included in the exception message short.
* Remove the osdefs.h #include; it was not needed in the final version ofFred Drake2000-08-152-2/+0
| | | | my last set of changes.
* When raising a SyntaxError, make a best-effort attempt to set theFred Drake2000-08-151-9/+29
| | | | | | | | | | filename and lineno attributes, but do not mask the SyntaxError if we fail. This is part of what is needed to close SoruceForge bug #110628 (Jitterbug PR#278). Wrap a long line to fit in under 80 columns.
* When raising a SyntaxError, make a best-effort attempt to set theFred Drake2000-08-151-1/+19
| | | | | | | | filename and lineno attributes, but do not mask the SyntaxError if we fail. This is part of what is needed to close SoruceForge bug #110628 (Jitterbug PR#278).
* SyntaxError__str__(): Do more formatting of the exception here, ratherFred Drake2000-08-151-6/+55
| | | | | | | | | than depending on the site that raises the exception. If the filename and lineno attributes are set on the exception object, use them to augment the message displayed. This is part of what is needed to close SoruceForge bug #110628 (Jitterbug PR#278).
* Guido pointed out that all names in the sys module have no underscore,Fred Drake2000-08-151-4/+5
|
* Fix the parent of WindowsError - both the comments in this source file, and ↵Mark Hammond2000-08-151-1/+1
| | | | the previous exceptions.py have WindowsError as a sub-class of OSError.
* The attempt to protect against MS_WIN16 compilers that do not support longFred Drake2000-08-141-1/+2
| | | | | | string literals has not been tested on an MS_WIN16 platform; the trailing ";" was inside the #ifndef MS_WIN16, which should cause an error (missing semi-colon) when compiled with that symbol #defined.
* Add a byte_order value to the sys module. The value is "big" forFred Drake2000-08-141-0/+13
| | | | big-endian machines and "little" for little-endian machines.
* The list comp patch checked for the second child node of the 'listmaker'Thomas Wouters2000-08-131-1/+1
| | | | | node, without checking if the node actually had more than one child. It can have only one node, though: '[' test ']'. This fixes it.
* The list comprehensions patch partly reversed the removal of UNPACK_LIST,Thomas Wouters2000-08-121-13/+0
| | | | re-introducing com_assign_list, now unused. Removed it.
* Clean up a couple of warnings on Win64. The downcast of the strlen size_tTrent Mick2000-08-121-1/+1
| | | | | return value to int is safe here because in each case it previouls checked that there will be no overflow.
* list comprehensions. seeSkip Montanaro2000-08-122-215/+425
| | | | | | http://sourceforge.net/patch/?func=detailpatch&patch_id=100654&group_id=5470 for details.
* Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since theyThomas Wouters2000-08-113-21/+7
| | | | | | | did the same anyway. I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of distutils, is it ? Should it try to be compatible with old bytecode version ?
* -- from Trent Mick: [Patch #101010] replace use of INT_PTRFredrik Lundh2000-08-071-5/+1
| | | | with uintptr_t (fix MSVC 5.0 build)
* When returning an error from jcompile() (which is passed through byGuido van Rossum2000-08-071-0/+8
| | | | | PyNode_Compile()), make sure that an exception is actually set -- otherwise someone stomped on our error. [2.0 checkin of this fix.]
* Avoid dumping core when PyErr_NormalizeException() is called withoutGuido van Rossum2000-08-071-0/+6
| | | | an exception set. This shouldn't happen, but we see it at times...
* Initialized opcode and oparg to silence a gcc -Wall warning.Moshe Zadka2000-08-071-2/+2
|
* Fix some strange indentation and grammar that have been bugging me forThomas Wouters2000-08-051-6/+5
| | | | weeks.
* Changed H specifier to mean "bitfield", i.e. any value fromJack Jansen2000-08-051-5/+27
| | | | | | -32768..65535 is acceptable. Added B specifier (with values from -128..255). No L added (which would have completed the set) because l already accepts any value (and the letter L is taken for quadwords).
* Removing warnings by gcc -Wall -- cast ugly || to void.Moshe Zadka2000-08-041-1/+1
|
* Add a test that Py_IsInitialized() in Py_InitModule4(). SeeGuido van Rossum2000-08-041-0/+2
| | | | | | | python-dev discussion. This should catch future version incompatibilities on Windows. Alas, this doesn't help for 1.5 vs. 1.6; but it will help for 1.6 vs. 2.0.
* This patch finalizes the move from UTF-8 to a default encoding inMarc-André Lemburg2000-08-031-4/+6
| | | | | | | | | | | | | | | | | | the Python Unicode implementation. The internal buffer used for implementing the buffer protocol is renamed to defenc to make this change visible. It now holds the default encoded version of the Unicode object and is calculated on demand (NULL otherwise). Since the default encoding defaults to ASCII, this will mean that Unicode objects which hold non-ASCII characters will no longer work on C APIs using the "s" or "t" parser markers. C APIs must now explicitly provide Unicode support via the "u", "U" or "es"/"es#" parser markers in order to work with non-ASCII Unicode strings. (Note: this patch will also have to be applied to the 1.6 branch of the CVS tree.)
* Changing the CNRI copyright notice according to CNRI's instructions.Guido van Rossum2000-08-031-1/+1
| | | | | This is a notice without a date, which apparently is not a claim to copyright but only advice to the reader. IANAL. :-)
* Both PEP 201 Lockstep Iteration and SF patch #101030 have beenBarry Warsaw2000-08-031-0/+56
| | | | | | | | | | | accepted by the BDFL. builtin_zip(): New function to implement the zip() function described in the above proposal. zip_doc[]: Docstring for zip(). builtin_methods[]: added entry for zip()
* Include the dependence of sysmodule on the patchlevel.h include, soFred Drake2000-08-011-1/+1
| | | | that sys.version_info will be built properly.
* merge Include/my*.h into Include/pyport.hPeter Schneider-Kamp2000-07-313-5/+2
| | | | marked my*.h as obsolete
* Use 'void' directly instead of the ANY #define, now that all code is ANSI C.Thomas Wouters2000-07-251-5/+5
| | | | Leave the actual #define in for API compatibility.
* Create a new section of pyport.h to hold all external function declarationsThomas Wouters2000-07-241-1/+0
| | | | | | | | | | | | | | for systems that are missing those declarations from system include files. Start by moving a pointy-haired ones from their previous locations to the new section. (The gethostname() one, for instance, breaks on several systems, because some define it as (char *, size_t) and some as (char *, int).) I purposely decided not to include the summary of used #defines like Tim did in the first section of pyport.h. In my opinion, the number of #defines likedly to be used by this section would make such an overview unwieldy. I would suggest documenting the non-obvious ones, though.
* Prototype yet another forward declaration.Thomas Wouters2000-07-241-1/+1
|
* Another missed ansification.Thomas Wouters2000-07-231-4/+1
|
* Included assert.h in Python.h -- it's absurd that this basic tool ofTim Peters2000-07-231-1/+1
| | | | | | | | good C practice hasn't been available to everything all along. Added Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) macro to pyport.h; this just casts VALUE from type WIDE to type NARROW, but assert-fails if Py_DEBUG is defined and info is lost due to casting. Replaced a line in Fredrik's fix to marshal.c to use the new macro.
* -- changed w_more to take an integer instead of a charFredrik Lundh2000-07-231-2/+2
| | | | (this is what the callers expect).
* Oops. One of last nights ANSIfication patches accidentily upped the bytecodeThomas Wouters2000-07-231-1/+1
| | | | | | MAGIC number. When updating it next time, be sure it's higher than 50715 * constants. (Shouldn't be a problem if everyone keeps to the proper algorithm.)