Commit Graph

19227 Commits

Author SHA1 Message Date
Barry Warsaw c86aa57f58 Documentation for PyString_FromFormat() and PyString_FromFormatV().
Closes SF patch #455666.
2001-08-28 02:31:28 +00:00
Jack Jansen 3070ee6b37 Experimental feature: allow \n as well as \r as newline for text files, by breaking in to the lowlevel I/O system. Can be disabled by defining WITHOUT_UNIX_NEWLINES. 2001-08-27 23:16:34 +00:00
Jeremy Hylton c59e220000 Handle private names
(Hard to believe these were never handled before)

Add misc.mangle() that mangles based on the rules in compile.c.
XXX Need to test the corner cases

Update CodeGenerator with a class_name attribute bound to None.  If a
particular instance is created within a class scope, the instance's
class_name is bound to that class's name.

Add mangle() method to CodeGenerator that mangles if the class_name
has a class_name in it.

Modify the FunctionCodeGenerator family to handle an extra argument--
the class_name.

Wrap all name ops and attrnames in calls to self.mangle()
2001-08-27 22:56:16 +00:00
Jack Jansen e7d8322630 exceptions was missing from the module list. Added. 2001-08-27 22:50:41 +00:00
Jack Jansen 535c524508 A quick hack to make the test pass on the Mac (similar to the quick hack
to make it pass on Windows:-).
2001-08-27 22:31:58 +00:00
Jeremy Hylton 80ea40d858 emit SET_LINENO for augmented assignments 2001-08-27 21:58:09 +00:00
Jeremy Hylton 2afff324ea Many changes -- bug fixes and sundry improvements
Make nested scopes enabled by default

Add is_constant_false() helper so that compiled code and symbols are
consistent with builtin compiler's handling of "if 0:"

Fix doc string handling to be consistent with recent change that
eliminates the doc string from the Module's node attribute.

Add fix to print handling from Evan & Shane.

Track change to visitor api by making "verbose" explicit.

Comment out setting CO_NESTED flag (it's unnecessary in 2.2).
2001-08-27 21:51:52 +00:00
Tim Peters 9f448150c8 Fix another test still expecting overflow on big int literals. 2001-08-27 21:50:42 +00:00
Tim Peters c15a82813a Change test_overflow to test_no_overflow; looks like big int literals
are auto-coerced to longs now, but this test still expected OverflowError.
I can't imagine this test failure was unique to Windows.
2001-08-27 21:45:32 +00:00
Jack Jansen 3c06b9a7d4 Use the new macresource module to open the accompanying resource file (if needed). 2001-08-27 21:41:23 +00:00
Jack Jansen a5d7da528b need() now returns the refno of the resource file opened, or None if the
specified resource was already available and no file was opened.
2001-08-27 21:37:45 +00:00
Jack Jansen de3226f7f9 Module to help other modules locate their resources. It currently knows about
resources in applets and separate OS9 style resource files, but it will
eventually also be thought the hoops to jump through on OSX/MachO.
2001-08-27 21:21:07 +00:00
Jack Jansen 8f2b13efce These have long outlived there usefulness, in my opinion. Moved to Unsupported. 2001-08-27 21:17:44 +00:00
Jeremy Hylton cd8a127e1a Fix for sibling nodes that define the same free variable
Evan Simpson's fix.  And his explanation:

    If you defined two nested functions in a row that refer to the
    same non-global variable, the second one will be generated as
    though the variable were global.
2001-08-27 21:06:35 +00:00
Jeremy Hylton 7e30c9bb5a Add lookup_name() to optimize use of stack frames
The use of com_node() introduces a lot of extra stack frames, enough
to cause a stack overflow compiling test.test_parser with the standard
interpreter recursionlimit.  The com_node() is a convenience function
that hides the dispatch details, but comes at a very high cost.  It is
more efficient to dispatch directly in the callers.  In these cases,
use lookup_node() and call the dispatched node directly.

Also handle yield_stmt in a way that will work with Python 2.1
(suggested by Shane Hathaway)
2001-08-27 21:02:51 +00:00
Jeremy Hylton 058a5adad0 Two changes to visitor API:
Remove _preorder as alias for dispatch and call dispatch directly.
    Add an extra optional argument to walk()

XXX Also comment out some code that does debugging prints.
2001-08-27 20:47:08 +00:00
Jeremy Hylton cccc478577 Why didn't I think of Fred off the top of my head? 2001-08-27 20:44:20 +00:00
Jeremy Hylton 627673396a Add everyone I can think of off the top of my head 2001-08-27 20:43:16 +00:00
Jeremy Hylton 2a8ec79353 Revise regrtest to compile entire standard library.
The tests are run from a copy of the library directory, where
everything has been compiled by the compiler package.

Add a raw_input() call at the end of the script, so that I can check
the output before the temp directory with the compiled code is
removed.
2001-08-27 20:40:43 +00:00
Jeremy Hylton 33c2a627f1 Add -c option to continue if one file has a SyntaxError 2001-08-27 20:39:21 +00:00
Jeremy Hylton 6d8c1aabff Add content-type header to ftp URLs (SF patch #454553)
Modify rfc822.formatdate() to always generate English names,
regardless of locale.  This is required by RFC 1123.

In open_local_file() of urllib and urllib2, use new formatdate() from
rfc822.
2001-08-27 20:16:53 +00:00
Michael W. Hudson 53da317801 Docs for the PEP 264 changes. 2001-08-27 20:02:17 +00:00
Jeremy Hylton 71b6af91d3 If an integer constant can't be generated from an integer literal
because of overflow, generate a long instead.
2001-08-27 19:45:25 +00:00
Tim Peters 9aa70d93aa SF bug [#455775] float parsing discrepancy.
PyTokenizer_Get:  error if exponent contains no digits (3e, 2.0e+, ...).
2001-08-27 19:19:28 +00:00
Jack Jansen de1d4957c0 Added Dean Draayer to the thank you list. 2001-08-27 15:30:48 +00:00
Jack Jansen 911e87de6f Patch by Dean Draayer: support for indeterminate progress bars. You
get these by specifying maxval=0, which is now also the default.

Untested.
2001-08-27 15:24:07 +00:00
Jack Jansen e259e5980c Patch by Bill Noon: added 'dylib' as a library type along with
'static' and 'shared'. This fixes extension building for dynamic
Pythons on MacOSX.
2001-08-27 15:08:16 +00:00
Jack Jansen 9403591014 Fixes by Thomas Heller:
- make the selftests work again (they were apparently not used since
  very early in bgen's development), with some minor cleanup by me
- make emacs python mode happier
2001-08-27 14:30:55 +00:00
Jack Jansen 06bd3234cb Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen. 2001-08-27 14:01:05 +00:00
Jack Jansen 206bd57355 When we're freezing to sourcecode and one of the modules is a dynamic module that is in a package we freeze that module at toplevel (outside any package). Not optimal, but there is little more we can do as config.c has no way to specify a builtin module has to be dumped into a package. 2001-08-27 13:59:35 +00:00
Jack Jansen 60aa4ccdc0 Updated to the current state of affairs. 2001-08-27 13:58:21 +00:00
Jack Jansen 1c2a2b71e1 Added targets for building the Carbon and Classic interpreter if you don't want to go through fullbuild.py. 2001-08-27 13:57:43 +00:00
Jack Jansen dc4d925be9 - A forgotten "from Carbon".
- Made the "killed unknown window" code dependent on a global var,
  so you can easily turn the behaviour off for IDE debugging.
2001-08-27 10:55:41 +00:00
Jack Jansen 4d3052acb0 A few forgotten "from Carbon"s. 2001-08-27 10:54:55 +00:00
Tim Peters 402d5985d8 SF patch [ #455137 ] Makes popen work with COMMAND.COM on WNT, from
Brian Quinlan.
2001-08-27 06:37:48 +00:00
Barry Warsaw 7c47beb860 Two improvements suggested by Greg Stein:
PyString_FromFormatV(): In the final resize at the end, we can use
    PyString_AS_STRING() since we know the object is a string and can
    avoid the typechecking.

PyString_FromFormat(): GS sez: "For safety/propriety, you should call
    va_end() on the vargs variable."
2001-08-27 03:11:09 +00:00
Jack Jansen 5a6fdcd371 Import the MacOS toolbox modules from the Carbon package. 2001-08-25 12:15:04 +00:00
Jack Jansen 6dba6bc0a2 Step 2 in putting the MacOS toolbox modules in a package: issue a DepracationWarning in the compatibility modules. 2001-08-25 11:53:43 +00:00
Tim Peters 6af5bbb565 PyString_FromFormatV: Massage platform %p output to match what gcc does,
at least in the first two characters.  %p is ill-defined, and people will
forever commit bad tests otherwise ("bad" in the sense that they fall
over (at least on Windows) for lack of a leading '0x'; 5 of the 7 tests
in test_repr.py failed on Windows for that reason this time around).
2001-08-25 03:02:28 +00:00
Guido van Rossum ea46fa8494 Undo previous checkin -- Barry fixed it better. 2001-08-24 19:46:21 +00:00
Guido van Rossum d320ad08bf Update test output to match new (more informative) error message about
calling unbound method with wrong first argument.
2001-08-24 19:31:43 +00:00
Barry Warsaw 191487351a Quick and dirty fix for test_extcall failures trigged by Guido's
recent classobject.c change.  When calling an unbound method with no
instances as first argument, the error message has changed.  The
message now contains the class name, but the output text being
compared to is too generic, so skip printing it.
2001-08-24 19:11:57 +00:00
Guido van Rossum 70d4491540 Remove the local 'getset' class -- this is now a built-in type with
the same signature.
2001-08-24 18:52:50 +00:00
Guido van Rossum 239abf7e23 getset_init(): the function name in the PyArg_ParseTuple() format
should just be "getset", not "getset.__init__".
2001-08-24 18:49:10 +00:00
Guido van Rossum a15dece519 Improve the error message issued when an unbound method is called with
an inappropriate first argument.  Now that there are more ways for
this to fail, make sure to report the name of the class of the
expected instance and of the actual instance.
2001-08-24 18:48:27 +00:00
Barry Warsaw 1e2775f370 Rip the import repr truncation test out of here and put it in test_repr.py 2001-08-24 18:38:02 +00:00
Barry Warsaw 0bcf6d8d54 Added lots of tests for reprs of "simple" objects, such as file,
lambda (anonymous functions?), function, xrange, buffer, cell (need to
fill in), and (some) descriptor types.

Also added a new test case for testing repr truncation fixes.
2001-08-24 18:37:32 +00:00
Barry Warsaw 876c8cb597 PyErr_Format(): Factor out most of this code into
PyString_FromFormat() since it's much more generally useful than
    just for exceptions.
2001-08-24 18:35:23 +00:00
Barry Warsaw 7ce3694a52 repr's converted to using PyString_FromFormat() instead of sprintf'ing
into a hardcoded char* buffer.

Closes patch #454743.
2001-08-24 18:34:26 +00:00
Barry Warsaw dadace004b PyString_FromFormat() and PyString_FromFormatV(): Largely ripped from
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.
2001-08-24 18:32:06 +00:00