summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Track changes to compiler APIJeremy Hylton2001-09-172-9/+15
|
* API change:Jeremy Hylton2001-09-176-20/+218
| | | | | | | | | | | | | | | | | | compile() becomes replacement for builtin compile() compileFile() generates a .pyc from a .py both are exported in __init__ compiler.parse() gets optional second argument to specify compilation mode, e.g. single, eval, exec Add AbstractCompileMode as parent class and Module, Expression, and Interactive as concrete subclasses. Each corresponds to a compilation mode. THe AbstractCompileMode instances in turn delegate to CodeGeneration subclasses specialized for their particular functions -- ModuleCodeGenerator, ExpressionCodeGeneration, InteractiveCodeGenerator.
* Re-created after change to astgen to calculate hardest_arg correctlyJeremy Hylton2001-09-172-1154/+1206
|
* Fix calculation of hardest_arg.Jeremy Hylton2001-09-172-6/+6
| | | | | | | | | The argument properties are ordered from easiest to hardest. The harder the arg, the more complicated that code that must be generated to return it from getChildren() and/or getChildNodes(). The old calculation routine was bogus, because it always set hardest_arg to the hardness of the last argument. Now use max() to always set it to the hardness of the hardest argument.
* Last set of change to get regression tests to passJeremy Hylton2001-09-176-10/+20
| | | | | | | | | | | Remove the only test in the syntax module. It ends up that the transformer must handle this error case. In the transformer, check for a list compression in com_assign_list() by looking for a list_for node where a comma is expected. In pycodegen.compile() re-raise the SyntaxError rather than catching it and exiting
* Add support for restricting access based on restricted execution mode.Guido van Rossum2001-09-172-7/+22
| | | | | | 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.
* Add -p option to invoke Python profilerJeremy Hylton2001-09-171-5/+11
|
* Only print attributes that start with co_.Jeremy Hylton2001-09-171-1/+6
| | | | | If passed a .py file as an argument, try to find its accompanying .pyc.
* Handle more syntax errors.Jeremy Hylton2001-09-174-58/+154
| | | | | | | | Invoke compiler.syntax.check() after building AST. If a SyntaxError occurs, print the error and exit without generating a .pyc file. Refactor code to use compiler.misc.set_filename() rather than passing filename argument around to each CodeGenerator instance.
* Add utility to set filename attribute on all nodesJeremy Hylton2001-09-172-0/+18
|
* Brian Quinlan's XML-RPC server framework.Fredrik Lundh2001-09-171-0/+254
|
* support true divisionJeremy Hylton2001-09-172-2/+6
|
* [Patch #462255, from Jason Tishler] Re-enables building the resouceAndrew M. Kuchling2001-09-172-3/+3
| | | | module on the Cygwin platform.
* SF patch #461781 by Chris Lawrence: os.path.realpath - Resolve symlinks:Guido van Rossum2001-09-176-0/+41
| | | | | | | | | | | | | | Once upon a time, I put together a little function that tries to find the canonical filename for a given pathname on POSIX. I've finally gotten around to turning it into a proper patch with documentation. On non-POSIX, I made it an alias for 'abspath', as that's the behavior on POSIX when no symlinks are encountered in the path. Example: >>> os.path.realpath('/usr/bin/X11/X') '/usr/X11R6/bin/X'
* Add cross-compilation defaults to most AC_TRY_RUN values. TheGuido van Rossum2001-09-172-42/+68
| | | | | | supplied values are the most "normal" or "common" values found for recent 32 bit machines. This now seems to work to build Python 2.2 for the ARM processor used on the iPAQ.
* PyObject_Dir(): Merge in __members__ and __methods__ too (if they exist,Tim Peters2001-09-172-0/+53
| | | | | | | | | | | | | | | and are lists, and then just the string elements (if any)). There are good and bad reasons for this. The good reason is to support dir() "like before" on objects of extension types that haven't migrated to the class introspection API yet. The bad reason is that Python's own method objects are such a type, and this is the quickest way to get their im_self etc attrs to "show up" via dir(). It looks much messier to move them to the new scheme, as their current getattr implementation presents a view of their attrs that's a untion of their own attrs plus their im_func's attrs. In particular, methodobject.__dict__ actually returns methodobject.im_func.__dict__, and if that's important to preserve it doesn't seem to fit the class introspection model at all.
* merge_class_dict(): Clear the error if __bases__ doesn't exist.Tim Peters2001-09-161-1/+3
|
* In a world with a growing number of subclassable types, replaceTim Peters2001-09-161-10/+8
| | | | | | | | type(x) is T tests with isinstance(x, T) Also got rid of a future-generators import, left over from code that wasn't intended to get checked in.
* Improve handling of docstrings. I had feared this was a case ofTim Peters2001-09-161-5/+10
| | | | | | introspection incompatibility, but in fact it's just that calltips always gave up on a docstring that started with a newline (but didn't realize they were giving up <wink>).
* Fixed typo in new 'p' description.Tim Peters2001-09-151-1/+1
|
* SF bug [#461674] struct 'p' format doesn't work (maybe)Tim Peters2001-09-151-7/+11
| | | | Rewrote the 'p' description.
* Since we had a bug with multiplication of dynamic long subclasses, add aTim Peters2001-09-151-1/+6
| | | | little test to make sure it doesn't come back.
* A fix for SF bug #461546 (bug in long_mul).Guido van Rossum2001-09-153-14/+33
| | | | | | | | | Both int and long multiplication are changed to be more careful in their assumptions about when one of the arguments is a sequence: the assumption that at least one of the arguments must be an int (or long, respectively) is still held, but the assumption that these don't smell like sequences is no longer true: a subtype of int or long may well have a sequence-repeat thingie!
* The 'p' (Pascal string) pack code acts unreasonably when the string sizeTim Peters2001-09-152-0/+27
| | | | | and count exceed 255. Changed to preserve as much of the string as possible (instead of count%256 characters).
* Add code generator for yield stmtJeremy Hylton2001-09-142-0/+10
|
* limit prefix test for lambdaJeremy Hylton2001-09-141-1/+1
| | | | | the compiler package generates a module-unique trailing suffix for each lambda
* del no longer necessary now that new module is goneJeremy Hylton2001-09-142-4/+0
|
* Various sundry changes for 2.2 compatibilityJeremy Hylton2001-09-144-274/+188
| | | | | | | | | | | | | | | Remove the option to have nested scopes or old LGB scopes. This has a large impact on the code base, by removing the need for two variants of each CodeGenerator. Add a get_module() method to CodeGenerator objects, used to get the future features for the current module. Set CO_GENERATOR, CO_GENERATOR_ALLOWED, and CO_FUTURE_DIVISION flags as appropriate. Attempt to fix the value of nlocals in newCodeObject(), assuming that nlocals is 0 if CO_NEWLOCALS is not defined.
* The object-being sliced in an assignment to a slice is referenced, notJeremy Hylton2001-09-142-4/+4
| | | | | | | bound. When a Yield() node is visited, assign to the generator attribute of the scope, not the visitor.
* the new new doesn't define CO_xxx as the old new didJeremy Hylton2001-09-142-2/+18
|
* the names attribute of Global is not a nodeJeremy Hylton2001-09-144-4/+4
|
* Update the warning about transporting marshals across boxes with differentTim Peters2001-09-141-13/+8
| | | | ideas about sizeof(long).
* Supply code objects a new-style tp_members slot and tp_getattr impl.Jeremy Hylton2001-09-141-16/+34
| | | | | The chief effects are to make dir() do something useful and supply them with an __class__.
* tp_new_wrapper(): A subtle change in the check for safe use.Guido van Rossum2001-09-141-1/+1
| | | | Allow staticbase != type, as long as their tp_new slots are the same.
* Add call_maybe(): a variant of call_method() that returnsGuido van Rossum2001-09-141-10/+67
| | | | | | NotImplemented when the lookup fails, and use this for binary operators. Also lookup_maybe() which doesn't raise an exception when the lookup fails (still returning NULL).
* Markup adjustments for consistency.Fred Drake2001-09-141-5/+6
|
* call_method():Guido van Rossum2001-09-141-36/+27
| | | | | | | | | | | | | | | | | | | | | | | - Don't turn a non-tuple argument into a one-tuple. Rather, the caller must pass a format that causes Py_VaBuildValue() to return a tuple. - Speed things up by calling PyObject_Call (which is fairly low-level and straightforward) rather than PyObject_CallObject (which calls PyEval_CallObjectWithKeywords which calls PyObject_Call, and nothing is really done in the mean time except some tests for NULL args and valid types, which are already guaranteed). - Cosmetics. Other places: - Make sure that the format argument to call_method() is surrounded by parentheses, so it will cause a tuple to be created. - Replace a few calls to PyEval_CallObject() with a surefire tuple for args to calls to PyObject_Call(). (A few calls to PyEval_CallObject() remain that have NULL for args.)
* PyObject_CallObject(): this may as well call PyEval_CallObject()Guido van Rossum2001-09-141-16/+1
| | | | | | | | | | | | | | | directly, as the only thing done here (replace NULL args with an empty tuple) is also done there. XXX Maybe we should take one step further and equate the two at the macro level? That's harder though because PyEval_Call* is declared in a header that's not included standard. But it is silly that PyObject_CallObject calls PyEval_CallObject which calls back to PyObject_Call. Maybe PyEval_CallObject should be moved into this file instead? All I know is that there are too many call APIs! The differences between PyObject_Call and PyEval_CallObjectWithKeywords is that the latter allows args to be NULL, and does explicit type checks for args and kwds.
* Mention SMTP additions and hmac module.Guido van Rossum2001-09-141-0/+6
|
* Add support for SMTP TLSAndrew M. Kuchling2001-09-141-0/+5
|
* SF patch #461413 (Gerhard Häring): Add STARTTLS feature to smtplibGuido van Rossum2001-09-142-2/+62
| | | | | | | | | | | This patch adds the features from RFC 2487 (Secure SMTP over TLS) to the smtplib module: - A starttls() function - Wrapper classes that simulate enough of sockets and files for smtplib, but really wrap a SSLObject - reset the list of known SMTP extensions at each call of ehlo(). This should have been the case anyway.
* _PyObject_Dump(): print the type of the object. This is by far theGuido van Rossum2001-09-141-2/+8
| | | | most frequently interesting information IMO. Also tidy up the output.
* The end of [#460467] file objects should be subclassable.Tim Peters2001-09-141-30/+63
| | | | | | | | A surprising number of changes to split tp_new into tp_new and tp_init. Turned out the older PyFile_FromFile() didn't initialize the memory it allocated in all (error) cases, which caused new sanity asserts elsewhere to fail left & right (and could have, e.g., caused file_dealloc to try decrefing random addresses).
* Changed the dict implementation to take "string shortcuts" only whenTim Peters2001-09-142-15/+52
| | | | | | | | | | | | | | | | keys are true strings -- no subclasses need apply. This may be debatable. The problem is that a str subclass may very well want to override __eq__ and/or __hash__ (see the new example of case-insensitive strings in test_descr), but go-fast shortcuts for strings are ubiquitous in our dicts (and subclass overrides aren't even looked for then). Another go-fast reason for the change is that PyCheck_StringExact() is a quicker test than PyCheck_String(), and we make such a test on virtually every access to every dict. OTOH, a str subclass may also be perfectly happy using the base str eq and hash, and this change slows them a lot. But those cases are still hypothetical, while Python's own reliance on true-string dicts is not.
* Get rid of builtin_open() entirely (the C code and docstring, not theTim Peters2001-09-132-22/+5
| | | | | builtin function); Guido pointed out that it could be just another name in the __builtin__ dict for the file constructor now.
* _PyBuiltin_Init(): For clarity, macroize this purely repetitive code.Tim Peters2001-09-131-49/+25
|
* Now that file objects are subclassable, you can get at the file constructorTim Peters2001-09-133-2/+52
| | | | | | just by doing type(f) where f is any file object. This left a hole in restricted execution mode that rexec.py can't plug by itself (although it can plug part of it; the rest is plugged in fileobject.c now).
* Use the keyword form of file() instead of open() to create TESTFN.Tim Peters2001-09-131-2/+2
|
* Added simple tests of keyword arguments in the basic type constructors.Tim Peters2001-09-131-0/+24
|
* type_call(): Change in policy. The keyword args (if any) are now passedTim Peters2001-09-132-3/+14
| | | | | | on to the tp_new slot (if non-NULL), as well as to the tp_init slot (if any). A sane type implementing both tp_new and tp_init should probably pay attention to the arguments in only one of them.